Repository navigation
fix(v3): add nil check to Focus() to prevent SIGSEGV after Hide - #4922
Conversation
The Focus() method was missing a nil/destroyed check on w.impl, causing a SIGSEGV when Focus() is called on a window that has been hidden and potentially destroyed (e.g., when clicking the dock icon after hiding the window on macOS). This aligns Focus() with Show() and Hide() which already have proper guards against nil/destroyed window implementations. Fixes wailsapp#4890 Co-Authored-By: Claude Opus 4.5 <[email protected]>
WalkthroughThis PR adds a changelog entry documenting a fix for a SIGSEGV crash that occurs when calling Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
leaanthony
left a comment
There was a problem hiding this comment.
LGTM! This is a clean fix that follows the existing pattern used in Show() and Hide(). The nil/destroyed check prevents the SIGSEGV crash reported in #4890.
A minor suggestion for the future: consider adding an UNRELEASED_CHANGELOG.md entry for bug fixes like this so they appear in the release notes.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
…sapp#4922) * fix(v3): add nil check to Focus() to prevent SIGSEGV after Hide The Focus() method was missing a nil/destroyed check on w.impl, causing a SIGSEGV when Focus() is called on a window that has been hidden and potentially destroyed (e.g., when clicking the dock icon after hiding the window on macOS). This aligns Focus() with Show() and Hide() which already have proper guards against nil/destroyed window implementations. Fixes wailsapp#4890 Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs: add changelog entry for Focus() nil check fix Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: ddmoney420 <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Lea Anthony <[email protected]>



Summary
Focus()method inwebview_window.goFocus()is called on a hidden/destroyed window (e.g., clicking dock icon afterwindow.Hide()on macOS)Problem
When handling the macOS dock icon click using
wailsEvents.Mac.ApplicationShouldHandleReopen, a SIGSEGV occurs if the main window was previously hidden viawindow.Hide().The
Focus()method was missing the nil/destroyed check thatShow()andHide()already have:Test plan
go build ./...passesgo test ./...passesReproduction repo: https://github.com/farhan687/wailsapp
Fixes #4890
🤖 Generated with Claude Code
Summary by CodeRabbit