summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-04-01 14:47:46 +0200
committerder richter <der.richter@gmx.de>2024-04-01 22:13:39 +0200
commit9c0fc83f4523a6d57a791a704a9710e7e72a634d (patch)
tree94b115178a3d4076492e87ac2b49cd160d3ad883 /osdep
parent67c48ed92230c174272c36c42d84049e5e6366fd (diff)
downloadmpv-9c0fc83f4523a6d57a791a704a9710e7e72a634d.tar.bz2
mpv-9c0fc83f4523a6d57a791a704a9710e7e72a634d.tar.xz
mac/apphub: only instantiate log and option when in Application mode
when in libmpv mode there is no need to for logging and reading options. this also prevents possible race conditions with the usage and deinit of the mpv_handler.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/mac/app_hub.swift10
1 files changed, 6 insertions, 4 deletions
diff --git a/osdep/mac/app_hub.swift b/osdep/mac/app_hub.swift
index a46bdc87c7..aba185cb2c 100644
--- a/osdep/mac/app_hub.swift
+++ b/osdep/mac/app_hub.swift
@@ -50,11 +50,13 @@ class AppHub: NSObject {
}
@objc func initMpv(_ mpv: OpaquePointer) {
- log.log = mp_log_new(UnsafeMutablePointer(mpv), mp_client_get_log(mpv), "app")
- option = OptionHelper(UnsafeMutablePointer(mpv), mp_client_get_global(mpv))
- input.option = option
event = EventHelper(self, mpv)
- self.mpv = event?.mpv
+ if let mpv = event?.mpv {
+ self.mpv = mpv
+ log.log = mp_log_new(UnsafeMutablePointer(mpv), mp_client_get_log(mpv), "app")
+ option = OptionHelper(UnsafeMutablePointer(mpv), mp_client_get_global(mpv))
+ input.option = option
+ }
#if HAVE_MACOS_MEDIA_PLAYER
remote?.registerEvents()