diff options
author | Akemi <der.richter@gmx.de> | 2018-11-17 13:12:01 +0100 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2019-04-02 02:02:02 +0300 |
commit | 3f6be8335001faac76789691f5b63e3a869d9e53 (patch) | |
tree | 44466dfade5ba756fa112ec9cbf375f3cfd9d172 /osdep/macOS_mpv_helper.swift | |
parent | b207c1d4a1cb4e92af4ff17d0145b1adee39fc6c (diff) | |
download | mpv-3f6be8335001faac76789691f5b63e3a869d9e53.tar.bz2 mpv-3f6be8335001faac76789691f5b63e3a869d9e53.tar.xz |
cocoa-cb: synchronise the flush with the render
this could lead to a crash on deinit when flush
was called while the opengl state was cleaned up.
Fixes #6323
Diffstat (limited to 'osdep/macOS_mpv_helper.swift')
-rw-r--r-- | osdep/macOS_mpv_helper.swift | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/osdep/macOS_mpv_helper.swift b/osdep/macOS_mpv_helper.swift index 20407968e2..8ceada6d2e 100644 --- a/osdep/macOS_mpv_helper.swift +++ b/osdep/macOS_mpv_helper.swift @@ -128,7 +128,7 @@ class MPVHelper: NSObject { return flags & UInt64(MPV_RENDER_UPDATE_FRAME.rawValue) > 0 } - func drawRender(_ surface: NSSize, skip: Bool = false) { + func drawRender(_ surface: NSSize, _ ctx: CGLContextObj, skip: Bool = false) { deinitLock.lock() if mpvRenderContext != nil { var i: GLint = 0 @@ -154,6 +154,9 @@ class MPVHelper: NSObject { glClearColor(0, 0, 0, 1) glClear(GLbitfield(GL_COLOR_BUFFER_BIT)) } + + if !skip { CGLFlushDrawable(ctx) } + deinitLock.unlock() } |