[vlc-commits] macosx: addons: Add references counting for callbacks as well
David Fuhrmann
git at videolan.org
Sun May 14 22:24:44 CEST 2017
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun May 14 22:22:31 2017 +0200| [dd128816e4967daa48a7af85a8270a38dc3e4e7d] | committer: David Fuhrmann
macosx: addons: Add references counting for callbacks as well
Make sure the given addon_entry_t value stays alive also while
being passed to the main thread.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dd128816e4967daa48a7af85a8270a38dc3e4e7d
---
modules/gui/macosx/VLCAddonsWindowController.m | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/modules/gui/macosx/VLCAddonsWindowController.m b/modules/gui/macosx/VLCAddonsWindowController.m
index b7df94786f..692faa9ccc 100644
--- a/modules/gui/macosx/VLCAddonsWindowController.m
+++ b/modules/gui/macosx/VLCAddonsWindowController.m
@@ -47,7 +47,7 @@ static void addonFoundCallback( addons_manager_t *manager,
VLCAddonsWindowController *controller = (__bridge VLCAddonsWindowController *) manager->owner.sys;
@autoreleasepool {
- [controller performSelectorOnMainThread:@selector(addAddon:) withObject:[NSValue valueWithPointer:entry] waitUntilDone:NO];
+ [controller performSelectorOnMainThread:@selector(addAddon:) withObject:[[VLCAddonListItem alloc] initWithAddon:entry] waitUntilDone:NO];
}
}
@@ -66,7 +66,7 @@ static void addonChangedCallback( addons_manager_t *manager,
VLCAddonsWindowController *controller = (__bridge VLCAddonsWindowController *) manager->owner.sys;
@autoreleasepool {
- [controller performSelectorOnMainThread:@selector(addonChanged:) withObject:[NSValue valueWithPointer:entry] waitUntilDone:NO];
+ [controller performSelectorOnMainThread:@selector(addonChanged:) withObject:[[VLCAddonListItem alloc] initWithAddon:entry] waitUntilDone:NO];
}
}
@@ -246,12 +246,11 @@ static void addonChangedCallback( addons_manager_t *manager,
#pragma mark - data handling
-- (void)addAddon:(NSValue *)o_value
+- (void)addAddon:(VLCAddonListItem *)entry
{
- addon_entry_t *p_entry = [o_value pointerValue];
/* no skin support on OS X so far */
- if (p_entry->e_type != ADDON_SKIN2)
- [_addons addObject:[[VLCAddonListItem alloc] initWithAddon:p_entry]];
+ if ([entry type] != ADDON_SKIN2)
+ [_addons addObject:entry];
}
- (void)discoveryEnded
@@ -260,7 +259,7 @@ static void addonChangedCallback( addons_manager_t *manager,
[_spinner stopAnimation:nil];
}
-- (void)addonChanged:(NSValue *)o_value
+- (void)addonChanged:(VLCAddonListItem *)entry
{
[self _refactorDataModel];
if (_shouldRefreshSideBarOnAddonChange) {
More information about the vlc-commits
mailing list