npapi-vlc | branch: master | Felix Paul Kühne <fkue...@videolan.org> | Mon Nov 
30 18:49:17 2015 +0100| [29c7471ae1e86a7df2124432c7ab1e8fd77bb8c4] | committer: 
Felix Paul Kühne

mac plugin: prevent runtime exception

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

 npapi/vlcplugin_mac.mm |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index 55e49fc..4eff126 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -183,6 +183,7 @@ VlcPluginMac::VlcPluginMac(NPP instance, NPuint16_t mode) :
 VlcPluginMac::~VlcPluginMac()
 {
     [(VLCPerInstanceStorage *)_perInstanceStorage release];
+    _perInstanceStorage = nil;
 }
 
 void VlcPluginMac::set_player_window()
@@ -550,9 +551,13 @@ bool VlcPluginMac::handle_event(void *event)
     [CATransaction begin];
     [aLayer removeFromSuperlayer];
     [CATransaction commit];
+    VLCPerInstanceStorage *storage = (VLCPerInstanceStorage 
*)_cppPlugin->_perInstanceStorage;
 
-    if ([(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage 
playbackLayer] == aLayer)
-        [(VLCPerInstanceStorage *)_cppPlugin->_perInstanceStorage 
setPlaybackLayer:nil];
+    if (storage != nil) {
+        if ([storage respondsToSelector:@selector(setPlaybackLayer:)]) {
+            [storage setPlaybackLayer:nil];
+        }
+    }
 }
 
 - (CGSize)currentOutputSize

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to