diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 0fb0852fdbc..2ac460c23cd 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -23,6 +23,9 @@ After processing, the content will be moved to the main changelog and this file ## Fixed +- Fix `Menu.Update()` not rebuilding the native menu on GTK4 Linux (#5659, independently diagnosed and fixed by @puneetdixit200 in #5539) +- Fix crash enumerating macOS screens on display change by copying screen id/name strings and snapshotting the count (#5565, independently diagnosed and fixed by @x-haose in #5584) +- Fix crash on Windows when `WM_ERASEBKGND` paints a solid background during a minimise/restore transition where `GetClientRect` returns nil (guard reported by @sinspired in #5636) - Fix frontend bindings error always parses as text by @mbaklor in #5690 - Fix Windows build failure when using the `server` build tag, caused by Windows GUI files missing the `!server` build constraint that the macOS and Linux equivalents already have (#5680) diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index 90b8e949028..2b3594bef5e 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -1666,11 +1666,16 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp if w.parent.options.BackgroundType == BackgroundTypeSolid { col := w.parent.options.BackgroundColour hdc := w32.HDC(wparam) - rc := w32.GetClientRect(w.hwnd) - colorRef := w32.COLORREF(uint32(col.Red) | uint32(col.Green)<<8 | uint32(col.Blue)<<16) - hbrush := w32.CreateSolidBrush(colorRef) - w32.FillRect(hdc, rc, hbrush) - w32.DeleteObject(w32.HGDIOBJ(hbrush)) + // GetClientRect can legitimately return nil for a window in a + // transient state (minimise/restore transitions are especially + // prone to triggering it). FillRect with a nil rect crashes, so it + // must be checked before painting. + if rc := w32.GetClientRect(w.hwnd); rc != nil { + colorRef := w32.COLORREF(uint32(col.Red) | uint32(col.Green)<<8 | uint32(col.Blue)<<16) + hbrush := w32.CreateSolidBrush(colorRef) + w32.FillRect(hdc, rc, hbrush) + w32.DeleteObject(w32.HGDIOBJ(hbrush)) + } } return 1 // WM_UAHDRAWMENUITEM is handled by MenuBarWndProc at the top of this function