mac/remote: remove make current observer when stopped

the observer is registered on every call of the start function. this
could lead to several registered observers for the same event and
several calls to the make current function, even though we only need it
once per event.

properly remove the observer on stop, so we only ever have one observer
registered.
This commit is contained in:
der richter 2024-02-07 23:47:10 +01:00
parent de36f11fa8
commit 07a3bf0365
1 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,12 @@ class RemoteCommandCenter: NSObject {
infoCenter.nowPlayingInfo = nil
infoCenter.playbackState = .unknown
NotificationCenter.default.removeObserver(
self,
name: NSApplication.willBecomeActiveNotification,
object: nil
)
}
@objc func makeCurrent(notification: NSNotification) {