cocoa-cb: render on main queue instead of dedicated queue

initially we drew on a dedicated render queue to circumvent certain
bottlenecks on the main queue, like concurrent events that could lead
to late drawing.

though due to the way cocoa works we need to draw an the main queue
otherwise we get undefined behaviour that could lead to crashes.

Fixes #10276
This commit is contained in:
der richter 2024-02-28 16:19:30 +01:00
parent 7758f6f50e
commit 15c48f3dc1
1 changed files with 1 additions and 3 deletions

View File

@ -82,8 +82,6 @@ class GLLayer: CAOpenGLLayer {
enum Draw: Int { case normal = 1, atomic, atomicEnd }
var draw: Draw = .normal
let queue: DispatchQueue = DispatchQueue(label: "io.mpv.queue.draw")
var needsICCUpdate: Bool = false {
didSet {
if needsICCUpdate == true {
@ -239,7 +237,7 @@ class GLLayer: CAOpenGLLayer {
func update(force: Bool = false) {
if force { forceDraw = true }
queue.async {
DispatchQueue.main.async {
if self.forceDraw || !self.inLiveResize {
self.needsFlip = true
self.display()