mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
cocoa-cb: fix freeing of macos_opts config group
using the MPContext as ta parent was a bad idea and shouldn't be done in any circumstances there because it only supposed to be for internal usage. this had the undesired effect that the options group was freed but still used since the MPContext is freed afterwards. instead manually free options group.
This commit is contained in:
parent
f21a980e37
commit
1eb6cbd093
@ -25,6 +25,7 @@ class LibmpvHelper: LogHelper {
|
||||
|
||||
var mpvHandle: OpaquePointer?
|
||||
var mpvRenderContext: OpaquePointer?
|
||||
var macOptsPtr: UnsafeMutableRawPointer?
|
||||
var macOpts: macos_opts = macos_opts()
|
||||
var fbo: GLint = 1
|
||||
let deinitLock = NSLock()
|
||||
@ -34,18 +35,15 @@ class LibmpvHelper: LogHelper {
|
||||
super.init(newlog)
|
||||
mpvHandle = mpv
|
||||
|
||||
guard let mpctx = UnsafeMutablePointer<MPContext>(mp_client_get_core(mpvHandle)) else {
|
||||
sendError("No MPContext available")
|
||||
exit(1)
|
||||
}
|
||||
guard let app = NSApp as? Application,
|
||||
let ptr = mp_get_config_group(mpctx,
|
||||
let ptr = mp_get_config_group(nil,
|
||||
mp_client_get_global(mpvHandle),
|
||||
app.getMacOSConf()) else
|
||||
{
|
||||
sendError("macOS config group couldn't be retrieved'")
|
||||
exit(1)
|
||||
}
|
||||
macOptsPtr = ptr
|
||||
macOpts = UnsafeMutablePointer<macos_opts>(OpaquePointer(ptr)).pointee
|
||||
}
|
||||
|
||||
@ -234,6 +232,8 @@ class LibmpvHelper: LogHelper {
|
||||
if destroy {
|
||||
mpv_destroy(mpvHandle)
|
||||
}
|
||||
ta_free(macOptsPtr)
|
||||
macOptsPtr = nil
|
||||
mpvHandle = nil
|
||||
log = nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user