summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-02-07 23:47:10 +0100
committerder richter <der.richter@gmx.de>2024-02-15 00:11:55 +0100
commit07a3bf0365b2246bd593ce965cd52d02b63fb66a (patch)
tree28893b3f48eab8f342ace41b7a33f8c929852581
parentde36f11fa8b25dd85f40cfc306540b586fe1899d (diff)
downloadmpv-07a3bf0365b2246bd593ce965cd52d02b63fb66a.tar.bz2
mpv-07a3bf0365b2246bd593ce965cd52d02b63fb66a.tar.xz
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.
-rw-r--r--osdep/macos/remote_command_center.swift6
1 files changed, 6 insertions, 0 deletions
diff --git a/osdep/macos/remote_command_center.swift b/osdep/macos/remote_command_center.swift
index 874ae88d84..26faea1b13 100644
--- a/osdep/macos/remote_command_center.swift
+++ b/osdep/macos/remote_command_center.swift
@@ -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) {