[vlc-commits] macosx/vout: Fix crash when vd is null

David Fuhrmann git at videolan.org
Sun Oct 2 17:25:21 CEST 2016


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Oct  2 17:23:35 2016 +0200| [6f3007d8525b22e8e5f03f2cff955276b4a96d96] | committer: David Fuhrmann

macosx/vout: Fix crash when vd is null

vd needs to be protected by the mutex behind self.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f3007d8525b22e8e5f03f2cff955276b4a96d96
---

 modules/video_output/macosx.m | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 6c13eb6..dc535da 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -838,16 +838,19 @@ static void OpenglSwap (vlc_gl_t *gl)
 {
     [super viewWillMoveToWindow:newWindow];
 
-    @try {
-        if (newWindow != nil) {
-            @synchronized(newWindow) {
-                [newWindow setColorSpace:vd->sys->nsColorSpace];
-            }
+    if (newWindow == nil)
+        return;
+
+    @synchronized (self) {
+        @try {
+            if (vd) [newWindow setColorSpace:vd->sys->nsColorSpace];
         }
+        @catch (NSException *exception) {
+            msg_Warn(vd, "Setting the window color space failed due to an Obj-C exception (%s, %s", [exception.name UTF8String], [exception.reason UTF8String]);
+        }
+
     }
-    @catch (NSException *exception) {
-        msg_Warn(vd, "Setting the window color space failed due to an Obj-C exception (%s, %s", [exception.name UTF8String], [exception.reason UTF8String]);
-    }
+
 }
 
 @end



More information about the vlc-commits mailing list