service/tray: fix watcher missing items that exit during registration - #1191
Open
diogochaves wants to merge 1 commit into
Open
diogochaves wants to merge 1 commit into
diogochaves wants to merge 1 commit into
Conversation
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 #1190
RegisterStatusNotifierItemandRegisterStatusNotifierHostchecked that the service had an owner before watching it. A service that disconnected in between was never unregistered, because itsNameOwnerChangedwent out before the watch existed.This watches the service first, then checks. If the owner is already gone, the watch is removed and the registration is ignored as before. This is the same order the SNI host, MPRIS and NetworkManager code already use when they look for a service.
If the service disconnects after the watch is added but before the check, the check ignores the registration and the pending event is then logged as
Got service unregister event for untracked service. The warning is harmless here, and I can lower it to debug if you prefer.Removing the watch in the ignored branch is safe even when another item from the same service is already registered. That item's watch was active before the service disconnected, so its unregister event is already pending, and
removeWatchedServicedoes not cancel pending events. I checked this by pausing quickshell with SIGSTOP, queueing a registration for a second item followed by the service's exit, and resuming: the first item was still removed.Testing
In a nested Hyprland session with its own session bus, running the Omarchy bar on stock 0.3.1 and on this build:
GetConnectionStats) is the same before and after, so ignored registrations don't leave watches behind.AI disclosure
I used an AI assistant (Claude) for this. It found the cause, wrote the change and ran the tests above, including the SIGSTOP test for the second-item case. I reviewed the change, reproduced the bug and the fix myself.