wails/v3
Lea Anthony d863e525e3
Fix Windows crash bug (#4460)
* ## 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
2025-08-04 20:45:01 +10:00
..
cmd/wails3 Add wails3 tool version command 2025-04-23 10:29:51 +10:00
examples [V3] Drag-n-Drop Zones and improvements (#4318) 2025-08-04 20:40:19 +10:00
internal [V3] Drag-n-Drop Zones and improvements (#4318) 2025-08-04 20:40:19 +10:00
pkg Fix Windows crash bug (#4460) 2025-08-04 20:45:01 +10:00
scripts Add clean v3 changelog validation workflow with external Go script 2025-07-13 10:33:00 +10:00
tasks [V3] Drag-n-Drop Zones and improvements (#4318) 2025-08-04 20:40:19 +10:00
test/docker feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
tests/window-visibility-test Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
wep [WEP] Customise Window Titlebars (#3508) 2024-06-08 13:42:27 +10:00
.gitignore Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
.prettierignore chore: add Prettier as format tool (#2689) 2023-05-30 07:40:54 +10:00
.prettierrc.yml chore: add Prettier as format tool (#2689) 2023-05-30 07:40:54 +10:00
go.mod fix: Implement robust cross-platform window visibility fallback for issue #2861 2025-06-14 12:59:44 +10:00
go.sum fix: Implement robust cross-platform window visibility fallback for issue #2861 2025-06-14 12:59:44 +10:00
README.md Update doc dependencies 2023-09-08 10:57:47 +10:00
release-notes.txt v3.0.0-alpha.18 2025-08-03 02:53:39 +00:00
release_notes.md v3.0.0-alpha.18 2025-08-03 02:53:39 +00:00
Taskfile.yaml [V3] Drag-n-Drop Zones and improvements (#4318) 2025-08-04 20:40:19 +10:00
TESTING.md feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
UNRELEASED_CHANGELOG.md Fix Windows crash bug (#4460) 2025-08-04 20:45:01 +10:00

v3 Alpha

Thanks for wanting to help out with testing/developing Wails v3! This guide will help you get started.

Getting Started

All the instructions for getting started are in the v3 documentation directory: mkdocs-website. Please read the README.md file in that directory for more information.