Sometimes fyne fails to setup dark mode
lostdusty opened this issue · comments
Checklist
- I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
- This issue only relates to a single bug. I will open new issues for any other problems.
Describe the bug
Happens randomly, with error code 0x800703e6.
Dark mode, however, is still set successfully.
How to reproduce
Use go run .
until it appears. Depends on your luck I guess.
Screenshots
No response
Example code
func main() {
a := app.New()
w := a.NewWindow("Hello")
hello := widget.NewLabel("Hello Fyne!")
w.SetContent(container.NewVBox(
hello,
widget.NewButton("Hi!", func() {
hello.SetText("Welcome :)")
}),
))
w.ShowAndRun()
}
Fyne version
2.4.4
Go compiler version
1.22.0
Operating system and version
Windows 10
Additional Information
Modified internal/driver/glfw/window_windows.go
to show the error code.
Sometimes this also happens here. Even though the theme is correctly set in the 'fyne elements', the Windows' own window top bar remains in light theme, as in the print below (exactly when it occurred). It throws the same error 0x800703e6.
The right behavior for the window would be:
I read the error HRESULT =0x800703e6 represents - ERROR_NOACCESS. A description of the code reveals the message invalid access to memory location.
Perhaps a possibility is that the window fyne tries to set to dark mode isn't fully initialized yet?
I take this opportunity to ask you: Were you using the SystemTray or SystemTrayMenu API when this occurred?
I were using none of them. At least on my machine the theme is still applied successfully, and I get the following error description: "The operation completed successfully."