From ca2c5c26d54fdcfa1ca3e921e6cf0bfa21110af3 Mon Sep 17 00:00:00 2001 From: Akemi Date: Fri, 2 Mar 2018 20:47:13 +0100 Subject: cocoa-cb: fix a segfault without video we activated the rendering loop a bit too early and it was possible that the first draw function was called before it was actually ready. this was a remnant from the old init routine and should have been changed. start the queue on reconfigure instead of preinit. --- video/out/cocoa_cb_common.swift | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index c3366ad2f7..93f941d473 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -72,8 +72,6 @@ class CocoaCB: NSObject { self.updateICCProfile() } startDisplayLink() - } else { - layer.setVideo(true) } } @@ -86,6 +84,7 @@ class CocoaCB: NSObject { if backendState == .needsInit { initBackend() } else { + layer.setVideo(true) updateWindowSize() layer.neededFlips += 1 } @@ -128,15 +127,13 @@ class CocoaCB: NSObject { } func updateWindowSize() { - if layer.hasVideo { - let targetScreen = getTargetScreen(forFullscreen: false) ?? NSScreen.main() - let wr = getWindowGeometry(forScreen: targetScreen!, videoOut: mpv.mpctx!.pointee.video_out) - if !window.isVisible { - window.makeKeyAndOrderFront(nil) - } - layer.atomicDrawingStart() - window.updateSize(wr.size) + let targetScreen = getTargetScreen(forFullscreen: false) ?? NSScreen.main() + let wr = getWindowGeometry(forScreen: targetScreen!, videoOut: mpv.mpctx!.pointee.video_out) + if !window.isVisible { + window.makeKeyAndOrderFront(nil) } + layer.atomicDrawingStart() + window.updateSize(wr.size) } func setAppIcon() { -- cgit v1.2.3