MacOSX/Framework/VLCLibrary.m: Clear potential memory leak & formatting clean up.
authorFaustino Osuna <riquedafreak@videolan.org>
Thu, 3 Jan 2008 20:54:02 +0000 (20:54 +0000)
committerFaustino Osuna <riquedafreak@videolan.org>
Thu, 3 Jan 2008 20:54:02 +0000 (20:54 +0000)
extras/MacOSX/Framework/Sources/VLCLibrary.m
extras/MacOSX/Framework/Sources/VLCMediaList.m
extras/MacOSX/Framework/Sources/VLCVideoView.m

index 91d2228..f3a42c5 100644 (file)
@@ -33,7 +33,7 @@ static VLCLibrary * sharedLibrary = nil;
 void __catch_exception( void * e, const char * function, const char * file, int line_number )
 {
     libvlc_exception_t * ex = (libvlc_exception_t *)e;
-    if (libvlc_exception_raised( ex ))
+    if( libvlc_exception_raised( ex ) )
     {
         NSException* libvlcException = [NSException
             exceptionWithName:@"LibVLCException"
@@ -92,13 +92,18 @@ static void * DestroySharedLibraryAtExit( void )
 
 - (void)dealloc 
 {
-    if (instance
+    if( instance 
     {
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
         
         libvlc_release( instance, &ex );
+        libvlc_exception_clear( &ex );
     }
+    
+    if( self == sharedLibrary ) 
+        sharedLibrary = nil;
+    
     instance = nil;
     [audio release];
     [super dealloc];
index e813142..a6d0378 100644 (file)
@@ -299,6 +299,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
     int start = [[[arrayOfArgs objectAtIndex: 0] objectForKey:@"index"] intValue];
     int end = [[[arrayOfArgs objectAtIndex: [arrayOfArgs count]-1] objectForKey:@"index"] intValue];
     NSRange range = NSMakeRange(start, end-start);
+
     [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndexesInRange:range] forKey:@"media"];
     for( NSDictionary * args in arrayOfArgs )
     {
index a0e96d9..34b6f7a 100644 (file)
@@ -65,8 +65,6 @@ NSString * VLCVideoViewLeftFullScreen       = @"VLCVideoViewLeftFullScreen";
 - (void)addVoutLayer:(CALayer *)aLayer;
 @end
 
-
-
 /******************************************************************************
  * Interface & Implementation VLCConstraintLayoutManager
  *