[vlc-commits] vout/caopengllayer: fix crash on close

Marvin Scholz git at videolan.org
Mon Feb 24 17:34:26 CET 2020


vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Feb  6 13:02:30 2020 +0100| [7d1e7f289deb0d9caa77053e83ba1f7b529bca1c] | committer: Marvin Scholz

vout/caopengllayer: fix crash on close

The CGL context was destroyed too early, so move around the
vout display removal to prevent using the already-gone context.

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7d1e7f289deb0d9caa77053e83ba1f7b529bca1c
---

 modules/video_output/caopengllayer.m | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 133aab06f4..74dd049536 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -224,6 +224,11 @@ static void Close (vlc_object_t *p_this)
     vout_display_t *vd = (vout_display_t *)p_this;
     vout_display_sys_t *sys = vd->sys;
 
+    if (sys->vgl != NULL && !OpenglLock(sys->gl)) {
+        vout_display_opengl_Delete(sys->vgl);
+        OpenglUnlock(sys->gl);
+    }
+
     if (sys->cgLayer) {
         if ([sys->container respondsToSelector:@selector(removeVoutLayer:)])
             [sys->container removeVoutLayer:sys->cgLayer];
@@ -242,11 +247,6 @@ static void Close (vlc_object_t *p_this)
     if (sys->embed)
         vout_display_DeleteWindow(vd, sys->embed);
 
-    if (sys->vgl != NULL && !OpenglLock(sys->gl)) {
-        vout_display_opengl_Delete(sys->vgl);
-        OpenglUnlock(sys->gl);
-    }
-
     if (sys->gl != NULL)
     {
         if (sys->gl->sys != NULL)



More information about the vlc-commits mailing list