mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
* ## Summary I've successfully fixed the nil pointer dereference bug in the Wails v3 system tray functionality on Windows. Here's what I addressed: **Root Cause**: The bug occurred in `systemtray_windows.go:80` where `*trayBounds = PhysicalToDipRect(*trayBounds)` was dereferencing a potentially nil pointer without checking. **Fixes Applied**: 1. **`positionWindow` method (lines 80-82)**: Added nil check for `trayBounds` before dereferencing 2. **`bounds` method (lines 121-123, 129-131)**: Added checks for uninitialized `hwnd` and nil return from `GetSystrayBounds` 3. **`iconIsInTrayBounds` method (lines 147-149, 155-157, 160-162)**: Added similar protective checks and taskbar position validation 4. **`getScreen` method (lines 173-175)**: Added `hwnd` initialization check 5. **`openMenu` method (lines 45-47)**: Added nil check for `trayBounds` **Key Improvements**: - Added proper initialization checks for `s.hwnd == 0` - Added nil pointer checks for all Windows API return values - Ensured graceful error handling instead of panics - Maintained existing functionality while preventing race conditions The fix addresses the race condition where system tray operations could be called before the tray was fully initialized, preventing the nil pointer dereference panic described in issue #4456. * Update changelog |
||
|---|---|---|
| .. | ||
| application | ||
| events | ||
| icons | ||
| mac | ||
| services | ||
| w32 | ||