aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Akemi <der.richter@gmx.de>2018-03-02 20:47:13 +0100
committerGravatar Kevin Mitchell <kevmitch@gmail.com>2018-03-04 19:08:45 -0800
commitca2c5c26d54fdcfa1ca3e921e6cf0bfa21110af3 (patch)
tree41ba16533ee0bcc42a6af6a301f697228660d28a
parent4d281927e5c5ad811501c7ec00065c62a75958a5 (diff)
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.
-rw-r--r--video/out/cocoa_cb_common.swift17
1 files 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() {