Changeset 39bd59801c1a0196f564403bd2adfad072801998

Show
Ignore:
Timestamp:
03/04/08 23:41:30 (5 months ago)
Author:
Faustino Osuna <enrique.osuna@gmail.com>
git-committer:
Faustino Osuna <enrique.osuna@gmail.com> 1204670490 +0000
git-parent:

[a0fd14f98085cea5c8de47ac771ee2e9a387c033]

git-author:
Faustino Osuna <enrique.osuna@gmail.com> 1204670490 +0000
Message:

macosx/VLCKit: Load VLCLibrary when VLCKit is loaded. No longer need atexit( ... ) to unload library, use attribute((destructor)) instead. Also make sure we don't autorelease the VLCLibrary (as the library's destructor will take care of that for us).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/macosx/framework/Headers/Public/VLCLibrary.h

    rb3372f1 r39bd598  
    2828#import "VLCMedia.h" 
    2929 
     30 
     31extern void * CreateSharedLibraryOnStartup( void ) __attribute__((constructor)); 
     32extern void * DestroySharedLibraryAtExit( void ) __attribute__((destructor)); 
     33 
    3034@class VLCAudio; 
    3135 
  • projects/macosx/framework/Sources/VLCLibrary.m

    r762b3db r39bd598  
    5050} 
    5151 
    52 static void * DestroySharedLibraryAtExit( void ) 
     52void * CreateSharedLibraryOnStartup( void )  
     53
     54    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
     55     
     56    /* This library is not loaded for no reason, so let's create 
     57     * a VLCLibrary instance. */ 
     58    [VLCLibrary sharedLibrary]; 
     59     
     60    [pool release]; 
     61     
     62    return NULL; 
     63
     64 
     65void * DestroySharedLibraryAtExit( void ) 
    5366{ 
    5467    /* Release the global object that may have been alloc-ed 
     
    6780        /* Initialize a shared instance */ 
    6881        sharedLibrary = [[self alloc] init]; 
    69          
    70         /* Make sure, this will get released at some point */ 
    71         atexit( (void *)DestroySharedLibraryAtExit ); 
    7282    } 
    73     return [[sharedLibrary retain] autorelease]
     83    return sharedLibrary
    7484} 
    7585