shiny/driver/internal/win32: send WM_CLOSE on Release
Calling DestroyWindow in Release is not allowed when
running on a different thread than the message pump.
This sends a WM_CLOSE message instead, that is handled by
the message pump itself.
Fixes golang/go#25671
Change-Id: Ie8610a8385faa2746dc7eabac11edc1106e8bb6e
Reviewed-on: https://go-review.googlesource.com/115998
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/shiny/driver/internal/win32/win32.go b/shiny/driver/internal/win32/win32.go
index 3fc939b..deaeb37 100644
--- a/shiny/driver/internal/win32/win32.go
+++ b/shiny/driver/internal/win32/win32.go
@@ -116,10 +116,7 @@
}
func Release(hwnd syscall.Handle) {
- // TODO(andlabs): check for errors from this?
- // TODO(andlabs): remove unsafe
- _DestroyWindow(hwnd)
- // TODO(andlabs): what happens if we're still painting?
+ SendMessage(hwnd, _WM_CLOSE, 0, 0)
}
func sendFocus(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr) (lResult uintptr) {