Commit c69f0eb4 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaList.m: Don't forget to alloc an autorelease pool on...

MacOSX/Framework/VLCMediaList.m: Don't forget to alloc an autorelease pool on function that may be called from a non-main thread context.
parent 933b9ff9
...@@ -46,6 +46,7 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted"; ...@@ -46,6 +46,7 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
/* libvlc event callback */ /* libvlc event callback */
static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_data) static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_data)
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
int index = event->u.media_list_item_added.index; int index = event->u.media_list_item_added.index;
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"]; [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"];
...@@ -55,17 +56,21 @@ static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_dat ...@@ -55,17 +56,21 @@ static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_dat
[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media", [VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index", [NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
nil]]; nil]];
[pool release];
} }
static void HandleMediaListWillAddItem(const libvlc_event_t *event, void *user_data) static void HandleMediaListWillAddItem(const libvlc_event_t *event, void *user_data)
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
int index = event->u.media_list_will_add_item.index; int index = event->u.media_list_will_add_item.index;
[self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"]; [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"];
[pool release];
} }
static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * user_data) static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * user_data)
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
int index = event->u.media_list_will_add_item.index; int index = event->u.media_list_will_add_item.index;
[self didChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"]; [self didChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"];
...@@ -75,13 +80,16 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -75,13 +80,16 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:) withMethod:@selector(mediaListItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]]; withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
[pool release];
} }
static void HandleMediaListWillDeleteItem(const libvlc_event_t *event, void *user_data) static void HandleMediaListWillDeleteItem(const libvlc_event_t *event, void *user_data)
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
int index = event->u.media_list_will_add_item.index; int index = event->u.media_list_will_add_item.index;
[self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"]; [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"Media"];
[pool release];
} }
@implementation VLCMediaList (KeyValueCodingCompliance) @implementation VLCMediaList (KeyValueCodingCompliance)
......
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