jkleinsc

#55725: fix: remove notification observer from the center it was registered on

Merged
Created: Nov 10, 2026, 2:49:30 PM
Merged: Nov 10, 2026, 7:15:03 PM
5 comments
Target: main

Requested by John Kleinschmidt · Slack thread

Description of Change

Request ids for macOS notification subscriptions come from a single counter shared by the distributed, local and workspace notification centers. When an id was unsubscribed through a different method than the one it was subscribed with (for example, an id from subscribeLocalNotification passed to unsubscribeNotification), DoUnsubscribeNotification erased the subscription but called removeObserver on the caller's notification center rather than the one the observer was registered on, so the observer stayed registered for the life of the process. It now removes the observer from the center stored with the subscription, as ClearNotificationSubscriptions already does, and the now-unused kind parameter is dropped.

This was found by a review bot while backporting #55629 (#55680). No spec was added because the leak isn't observable from JS: with the subscription erased, the callback no longer fires either way.

Checklist

Release Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vf2yMwv2LMkF9YULfTdXCy

Notes: Fixed a macOS notification observer leak when unsubscribing via another method.

Backports

44-x-y
In-flight
PR Number
#55733
Waiting to be merged
45-x-y
In-flight
PR Number
#55732
Waiting to be merged
46-x-y
In-flight
PR Number
#55731
Waiting to be merged

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron