1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-07 14:47:53 +00:00

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.
This commit is contained in:
Akemi 2018-03-02 20:47:13 +01:00 committed by Kevin Mitchell
parent 4d281927e5
commit ca2c5c26d5

View File

@ -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() {