瀏覽代碼

MacOSX/Framework/VLCLibrary.m: Clear potential memory leak & formatting clean up.

Faustino Osuna 17 年之前
父節點
當前提交
57ba3e2bee
共有 3 個文件被更改,包括 8 次插入4 次删除
  1. 7 2
      Sources/VLCLibrary.m
  2. 1 0
      Sources/VLCMediaList.m
  3. 0 2
      Sources/VLCVideoView.m

+ 7 - 2
Sources/VLCLibrary.m

@@ -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];

+ 1 - 0
Sources/VLCMediaList.m

@@ -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 )
     {

+ 0 - 2
Sources/VLCVideoView.m

@@ -65,8 +65,6 @@ NSString * VLCVideoViewLeftFullScreen       = @"VLCVideoViewLeftFullScreen";
 - (void)addVoutLayer:(CALayer *)aLayer;
 @end
 
-
-
 /******************************************************************************
  * Interface & Implementation VLCConstraintLayoutManager
  *