-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
We have seen the following stack trace a few times when opening our Wails program. We use a systray icon, attached to a systray menu, and sometimes change the systray icon depending on the application state.
runtime error: invalid memory address or nil pointer dereference
Stack trace:
runtime.panicmem
at runtime/panic.go:262
runtime.sigpanic
at runtime/signal_windows.go:401
github.com/wailsapp/wails/v3/pkg/w32.RectInRect
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/w32/user32.go:817
github.com/wailsapp/wails/v3/pkg/application.(*windowsSystemTray).iconIsInTrayBounds
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/systemtray_windows.go:145
github.com/wailsapp/wails/v3/pkg/application.(*windowsSystemTray).positionWindow
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/systemtray_windows.go:67
github.com/wailsapp/wails/v3/pkg/application.(*SystemTray).PositionWindow.func1
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/systemtray.go:129
github.com/wailsapp/wails/v3/pkg/application.InvokeSyncWithError.func1
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/mainthread.go:51
github.com/wailsapp/wails/v3/pkg/application.(*windowsApp).invokeCallback
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/mainthread_windows.go:125
github.com/wailsapp/wails/v3/pkg/application.(*windowsApp).wndProc
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/application_windows.go:205
runtime.callbackWrap
at runtime/syscall_windows.go:396
runtime.cgocallbackg1
at runtime/cgocall.go:444
runtime.cgocallbackg
at runtime/cgocall.go:350
runtime.cgocallback
at runtime/asm_arm64.s:1131
runtime.systemstack_switch
at runtime/asm_arm64.s:201
runtime.cgocall
at runtime/cgocall.go:185
runtime.syscall_syscalln
at runtime/syscall_windows.go:521
syscall.SyscallN
at runtime/syscall_windows.go:500
syscall.(*Proc).Call
at syscall/dll_windows.go:167
syscall.(*LazyProc).Call
at syscall/dll_windows.go:287
github.com/wailsapp/wails/v3/pkg/w32.DispatchMessage
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/w32/user32.go:463
github.com/wailsapp/wails/v3/pkg/application.(*windowsApp).runMainLoop
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/mainthread_windows.go:64
github.com/wailsapp/wails/v3/pkg/application.(*windowsApp).run
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/application_windows.go:163
github.com/wailsapp/wails/v3/pkg/application.(*App).Run
at github.com/wailsapp/wails/v3@v3.0.0-alpha.10/pkg/application/application.go:591
main.main
at github.com/DefinedNet/dnclient/cmd/dnclient-desktop/main.go:36
runtime.main
at runtime/proc.go:283
runtime.goexit
at runtime/asm_arm64.s:1223
To Reproduce
This has occurred once immediately after starting the app (though one of the first things the app does is check some system state and then update the system tray and menu accordingly.) In another case, this happened after a systray menu item was clicked, which should have triggered a window opening.
Expected behaviour
No panics.
Screenshots
No response
Attempted Fixes
No response
System Details
Wails (v3.0.0-alpha.10) Wails Doctor
# System
┌──────────────────────────────────────────────────┐
| Name | MacOS |
| Version | 15.5 |
| ID | 24F74 |
| Branding | Sequoia |
| Platform | darwin |
| Architecture | arm64 |
| Apple Silicon | true |
| CPU | Apple M4 Max |
| CPU 1 | Apple M4 Max |
| CPU 2 | Apple M4 Max |
| GPU | 40 cores, Metal Support: Metal 3 |
| Memory | 128 GB |
└──────────────────────────────────────────────────┘
# Build Environment
┌────────────────────────────────┐
| Wails CLI | v3.0.0-alpha.10 |
| Go Version | go1.24.4 |
| -buildmode | exe |
| -compiler | gc |
| CGO_CFLAGS | |
| CGO_CPPFLAGS | |
| CGO_CXXFLAGS | |
| CGO_ENABLED | 1 |
| CGO_LDFLAGS | |
| GOARCH | arm64 |
| GOARM64 | v8.0 |
| GOOS | darwin |
└────────────────────────────────┘
# Dependencies
┌────────────────────────────────────────────────────────────────────────┐
| Xcode cli tools | 2409 |
| npm | 10.9.2 |
| *NSIS | Not Installed. Install with `brew install makensis`. |
| |
└─────────────────────── * - Optional Dependency ────────────────────────┘
# Checking for issues
SUCCESS No issues found
# 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
Additional context
We are running a slight fork of v3.0.0-alpha.10 with a few commits pulled in from the mega-menu-fixes
branch to fix other panics we saw more frequently: v3.0.0-alpha.10...DefinedNet:wails:windows-fixes
That being said, the panic does not appear directly related to the code in any of these commits.