Repository navigation
fix(windows): explicitly delete shell notify icon on teardown to prev… - #291
Open
HarshalPatel1972 wants to merge 2 commits into
Open
HarshalPatel1972 wants to merge 2 commits into
HarshalPatel1972 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves Windows tray icon shutdown behavior to prevent “ghost” notification area icons by explicitly removing the tray icon earlier in the window lifecycle.
Changes:
- Delete the tray icon during
WM_CLOSEbefore destroying/unregistering the window class. - Add a double-delete guard by setting
t.nid = nilafter deletion in bothWM_CLOSEandWM_ENDSESSION.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… avoid potential deadlocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #237
Problem
When applications using this library exit on Windows, the icon often remains stagnant in the taskbar notification system tray as a "ghost" icon. It only disappears when a user explicitly hovers their mouse pointer over it, forcing the Windows Shell to realize the backing thread/process is dead.
Fix
Intercepted
WM_CLOSEandWM_ENDSESSIONwindow messages insidewndProcto explicitly invoket.nid.delete()(which triggersShell_NotifyIconWwithNIM_DELETE).t.muNIDmutex lock.t.nid = nilpost-deletion to safely protect the execution path against double-deletion issues if multiple teardown signals fire sequentially.Tested on
Windows 11 (Go 1.26 verification build passes cleanly).