Commit 2e7f3ec5 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCLibrary.m: Regroup the sharedLibrary allocation and...

MacOSX/Framework/VLCLibrary.m: Regroup the sharedLibrary allocation and release. Fix a warning due to a left over in previous commit.
parent 0e514bd7
......@@ -42,14 +42,14 @@ void __quit_on_exception( void * e, const char * function, const char * file, in
}
}
static void *DestroySharedLibraryAtExit()
static void * DestroySharedLibraryAtExit( void )
{
/* Release the global object that may have been alloc-ed
* in -[VLCLibrary init] */
[sharedLibrary release];
sharedLibrary = nil;
return nil;
return NULL;
}
@implementation VLCLibrary
......@@ -57,8 +57,11 @@ static void *DestroySharedLibraryAtExit()
{
if (!sharedLibrary)
{
// Initialize a shared instance
[[self alloc] init];
/* Initialize a shared instance */
sharedLibrary = [[self alloc] init];
/* Make sure, this will get released at some point */
atexit( (void*)DestroySharedLibraryAtExit );
}
return [[sharedLibrary retain] autorelease];
}
......@@ -89,15 +92,11 @@ static void *DestroySharedLibraryAtExit()
instance = (void *)libvlc_new( 7, lib_vlc_params, &ex );
quit_on_exception( &ex );
if (!sharedLibrary)
sharedLibrary = self;
// Assignment unneeded, as the audio unit will do it for us
/*audio = */ [[VLCAudio alloc] initWithLibrary:self];
// free allocated resources
free( applicationPath );
atexit(DestroySharedLibraryAtExit);
}
return self;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment