[client] Fix UI crash on Windows builds without dark-mode support (#6958)

This commit is contained in:
Viktor Liu
2026-07-29 20:52:18 +09:00
committed by GitHub
parent df39c2b254
commit f2c1070f95

View File

@@ -0,0 +1,14 @@
package services
import "github.com/wailsapp/wails/v3/pkg/w32"
// Wails assigns w32.AllowDarkModeForWindow only on builds >= 18334 but calls it
// without a nil check when a window requests the Dark theme, crashing older
// builds such as Windows Server 2019 (17763). Those builds still get a dark
// title bar via the pre-20H1 DWM attribute that w32.SetTheme applies, so a
// no-op stub keeps the Dark theme fully working there.
func init() {
if w32.AllowDarkModeForWindow == nil {
w32.AllowDarkModeForWindow = func(w32.HWND, bool) uintptr { return 0 }
}
}