Skip to content

Commit

Permalink
mac/apphub: only instantiate log and option when in Application mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Akemi committed Apr 1, 2024
1 parent 67c48ed commit 9c0fc83
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions osdep/mac/app_hub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9c0fc83

Please sign in to comment.