Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows (v3): Sometimes clicking the systray notifcation menu icon crashes #4151

Open
johnmaguire opened this issue Mar 19, 2025 · 4 comments
Labels
Bug Something isn't working

Comments

@johnmaguire
Copy link

johnmaguire commented Mar 19, 2025

Description

All I did was run the systray-menu example and click the icon over and over. Eventually it crashes. (I've seen this behavior in our own app too without repeatedly clicking the icon. Probably some kind of race.)

PS C:\Users\jmaguire\src\wails\v3\examples> cd .\systray-menu\
PS C:\Users\jmaguire\src\wails\v3\examples\systray-menu> go run .
Mar 19 15:05:30.736 INF Build Info: Wails=v3.0.0-dev Compiler=go1.24.0 -buildmode=exe -compiler=gc CGO_ENABLED=0 GOARCH=amd64 GOOS=windows GOAMD64=v1
Mar 19 15:05:30.738 INF AssetServer Info: middleware=true handler=true
Mar 19 15:05:30.738 INF Platform Info: Go-WebView2Loader=true WebView2=134.0.3124.72 ID=24H2 Name="Windows 10 Pro" Version="2009 (Build: 26100)" Branding="Windows 11 Pro"
2025/03/19 15:05:30 [WebView2] Environment created successfully
Mar 19 15:05:30.985 INF [AssetFileServerFS] Handling request url=/ file=.
Mar 19 15:05:30.987 INF Asset Request: windowName="" windowID=1 code=200 method=GET path=/ duration=1.6087ms
Mar 19 15:05:31.007 INF Asset Request: windowName="" windowID=1 code=200 method=GET path=/runtime.js duration=505.6µs
Mar 19 15:05:31.036 INF [AssetFileServerFS] Handling request url=/favicon.ico file=favicon.ico
Mar 19 15:05:31.036 INF Asset Request: windowName="" windowID=1 code=404 method=GET path=/favicon.ico duration=0s
Mar 19 15:05:38.751 ERR

******************************** FATAL *********************************
*      There has been a catastrophic failure in your application.      *
**************************** Error Details *****************************
TrackPopupMenu failed************************************************************************

[0319/150538.752:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1412
exit status 1

https://discord.com/channels/1042734330029547630/1351996470974484632

To Reproduce

  1. cd v3/examples/systray-menu
  2. go run .
  3. Click the systray icon a bunch

Expected behaviour

No crashes :)

Screenshots

No response

Attempted Fixes

No response

System Details

 Wails (v3.0.0-alpha.9)  Wails Doctor

# System

┌──────────────────────────────────────────────────────────────────────────────────────────────┐
| Name              | Windows 10 Pro                                                           |
| Version           | 2009 (Build: 26100)                                                      |
| ID                | 24H2                                                                     |
| Branding          | Windows 11 Pro                                                           |
| Platform          | windows                                                                  |
| Architecture      | amd64                                                                    |
| Go WebView2Loader | true                                                                     |
| WebView2 Version  | 134.0.3124.72                                                            |
| CPU 1             | Apple Silicon                                                            |
| CPU 2             | Apple Silicon                                                            |
| CPU 3             | Apple Silicon                                                            |
| CPU 4             | Apple Silicon                                                            |
| GPU 1             | Parallels Display Adapter (WDDM) (Parallels) - Driver: 20.18.2022.55879  |
| Memory            | 8GB                                                                      |
└──────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-alpha.9                                                                                                                                                                                                           |
| Go Version     | go1.24.0                                                                                                                                                                                                                 |
| -buildmode     | exe                                                                                                                                                                                                                      |
| -compiler      | gc                                                                                                                                                                                                                       |
| CGO_ENABLED    | 0                                                                                                                                                                                                                        |
| DefaultGODEBUG | asynctimerchan=1,gotestjsonbuildtext=1,gotypesalias=0,httpservecontentkeepheaders=1,multipathtcp=0,randseednop=0,rsa1024min=0,tls3des=1,tlsmlkem=0,x509keypairleaf=0,x509negativeserial=1,x509rsacrt=0,x509usepolicies=0 |
| GOAMD64        | v1                                                                                                                                                                                                                       |
| GOARCH         | amd64                                                                                                                                                                                                                    |
| GOOS           | windows                                                                                                                                                                                                                  |
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies

┌───────────────────────────┐
| NSIS | Not Installed      |
| npm  | 10.9.2             |
└─ * - Optional Dependency ─┘

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor
PS C:\Users\jmaguire\src\wails\v3\examples\systray-menu>

Additional context

No response

@johnmaguire johnmaguire added the Bug Something isn't working label Mar 19, 2025
@leaanthony
Copy link
Member

I'm guessing that there's a race condition between the popup being drawn and the TrackPopupMenu call. We could incorporate a debounce. Was it the button to show the menu over and over again?

@johnmaguire
Copy link
Author

I am clicking the icon here repeatedly. In my first repro, I clicked nothing but the icon over and over:

Image

But I did find another reliable way to reproduce it... if I first click on the network icon next to it, and then try clicking on the Wails icon, the menu opens, but I can't click off of it to close it. Then, if I click it a second time, I get the same crash from above.

Screen.Recording.2025-03-19.at.3.31.19.PM.mov

@johnmaguire
Copy link
Author

So, I can confirm that the issue with being unable to "click off" the menu seems to be a Windows bug (I can reproduce this with Windows Defender, and it actually pops the menu "under" the taskbar.) But I think we should be able to avoid a crash in this case still.

Screen.Recording.2025-03-19.at.3.42.54.PM.mov

@PietervdWerk
Copy link

PietervdWerk commented Mar 26, 2025

On MacOs on a fresh install of a wails3 project, following the docs for the systray also crashes the program when clicking outside of the application.

Screen.Recording.2025-03-26.at.23.01.23.mov

(the recording doesn't show the mouse icon changes to a loading icon when hovering over the wails app)

System

┌──────────────────────────────────────────────────┐
| Name | MacOS |
| Version | 14.5 |
| Branding | Sonoma |
| Platform | darwin |
| Architecture | arm64 |
| Apple Silicon | true |
└──────────────────────────────────────────────────┘

Build Environment

Wails CLI | v3.0.0-alpha.9 Go Version | go1.24.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants