summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa_cb_common.swift
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-02-16 23:54:52 +0100
committerder richter <der.richter@gmx.de>2024-02-18 17:25:05 +0100
commitac275a823d9c86168dd7ee39bcc7e3aa1b4830dc (patch)
treeaf3080a891c02ca7b2683a667b84e04b5b3c387c /video/out/cocoa_cb_common.swift
parent3fd840f85dc52da99feee0c682e22f5867f8c8cb (diff)
downloadmpv-ac275a823d9c86168dd7ee39bcc7e3aa1b4830dc.tar.bz2
mpv-ac275a823d9c86168dd7ee39bcc7e3aa1b4830dc.tar.xz
cocoa-cb: lock CGLContext on uninit and manual redraw
this fixes a crash on quit, when a CATransaction from a system owned thread/event is happening at the same time. locking the context synchronises these access and prevents the race condition. the draw operation induced by any display call from the CAOpenGLLayer doesn't need that lock, since the display function already does lock that current context. Fixes #11681
Diffstat (limited to 'video/out/cocoa_cb_common.swift')
-rw-r--r--video/out/cocoa_cb_common.swift2
1 files changed, 2 insertions, 0 deletions
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift
index 4655cabf9b..094dab1a55 100644
--- a/video/out/cocoa_cb_common.swift
+++ b/video/out/cocoa_cb_common.swift
@@ -209,7 +209,9 @@ class CocoaCB: Common {
uninit()
uninitCommon()
+ layer?.lockCglContext()
libmpv.deinitRender()
+ layer?.unlockCglContext()
libmpv.deinitMPV(destroy)
}