Changeset 39bd59801c1a0196f564403bd2adfad072801998
- 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
| rb3372f1 |
r39bd598 |
|
| 28 | 28 | #import "VLCMedia.h" |
|---|
| 29 | 29 | |
|---|
| | 30 | |
|---|
| | 31 | extern void * CreateSharedLibraryOnStartup( void ) __attribute__((constructor)); |
|---|
| | 32 | extern void * DestroySharedLibraryAtExit( void ) __attribute__((destructor)); |
|---|
| | 33 | |
|---|
| 30 | 34 | @class VLCAudio; |
|---|
| 31 | 35 | |
|---|
| r762b3db |
r39bd598 |
|
| 50 | 50 | } |
|---|
| 51 | 51 | |
|---|
| 52 | | static void * DestroySharedLibraryAtExit( void ) |
|---|
| | 52 | void * 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 | |
|---|
| | 65 | void * DestroySharedLibraryAtExit( void ) |
|---|
| 53 | 66 | { |
|---|
| 54 | 67 | /* Release the global object that may have been alloc-ed |
|---|
| … | … | |
| 67 | 80 | /* Initialize a shared instance */ |
|---|
| 68 | 81 | sharedLibrary = [[self alloc] init]; |
|---|
| 69 | | |
|---|
| 70 | | /* Make sure, this will get released at some point */ |
|---|
| 71 | | atexit( (void *)DestroySharedLibraryAtExit ); |
|---|
| 72 | 82 | } |
|---|
| 73 | | return [[sharedLibrary retain] autorelease]; |
|---|
| | 83 | return sharedLibrary; |
|---|
| 74 | 84 | } |
|---|
| 75 | 85 | |
|---|