[vlc-commits] vout-macosx: add exception handler for color space setter as the NSWindow may be nuked without us being notified about it

Felix Paul Kühne git at videolan.org
Mon Sep 26 21:20:50 CEST 2016


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Sep 26 21:20:40 2016 +0200| [d52e38f3729cd959b8ff13f90fd3bdceb6d95c8d] | committer: Felix Paul Kühne

vout-macosx: add exception handler for color space setter as the NSWindow may be nuked without us being notified about it

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

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

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 4458b46..6c13eb6 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -838,11 +838,16 @@ static void OpenglSwap (vlc_gl_t *gl)
 {
     [super viewWillMoveToWindow:newWindow];
 
-    if (newWindow != nil) {
-        @synchronized(newWindow) {
-            [newWindow setColorSpace:vd->sys->nsColorSpace];
+    @try {
+        if (newWindow != nil) {
+            @synchronized(newWindow) {
+                [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]);
+    }
 }
 
 @end



More information about the vlc-commits mailing list