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:
parent
4d281927e5
commit
ca2c5c26d5
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user