Browse Source

VLCLibrary: retain the library instance since it's valuable

Felix Paul Kühne 12 years ago
parent
commit
37bead5d6a
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Sources/VLCLibrary.m

+ 5 - 0
Sources/VLCLibrary.m

@@ -63,6 +63,7 @@ static VLCLibrary * sharedLibrary = nil;
         }
         unsigned argc = sizeof(lib_vlc_params)/sizeof(lib_vlc_params[0]);
         instance = libvlc_new(argc, lib_vlc_params);
+        libvlc_retain(instance);
         NSAssert(instance, @"libvlc failed to initialize");
     }
     return self;
@@ -176,11 +177,15 @@ static VLCLibrary * sharedLibrary = nil;
 @implementation VLCLibrary (VLCLibVLCBridging)
 + (void *)sharedInstance
 {
+    NSAssert([self sharedLibrary].instance, @"shared library doesn't have an instance");
+
     return [self sharedLibrary].instance;
 }
 
 - (void *)instance
 {
+    NSAssert(instance, @"library doesn't have an instance");
+
     return instance;
 }
 @end