vlc/vlc-2.2 | branch: master | David Fuhrmann <[email protected]> | Thu Dec 29 19:49:20 2016 +0100| [a006455bc441f7b67119bad9b90ed094b5db7c40] | committer: David Fuhrmann
macosx: Fix parsing of item information All items need to be passed to local tree items within one lock. This code is already rewritten in vlc.git branch. fixes #17765 > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=a006455bc441f7b67119bad9b90ed094b5db7c40 --- modules/gui/macosx/playlistinfo.h | 2 ++ modules/gui/macosx/playlistinfo.m | 41 +++++++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/modules/gui/macosx/playlistinfo.h b/modules/gui/macosx/playlistinfo.h index 5574cf8..ca3d463 100644 --- a/modules/gui/macosx/playlistinfo.h +++ b/modules/gui/macosx/playlistinfo.h @@ -133,6 +133,8 @@ @property (readonly) NSString * name; @property (readonly) NSString * value; +- (void)setChildren:(NSMutableArray *)children; + - (VLCInfoTreeItem *)childAtIndex:(NSUInteger)i_index; - (void)refresh; diff --git a/modules/gui/macosx/playlistinfo.m b/modules/gui/macosx/playlistinfo.m index aa54d1e..2646dea 100644 --- a/modules/gui/macosx/playlistinfo.m +++ b/modules/gui/macosx/playlistinfo.m @@ -473,26 +473,27 @@ error: for (int i = 0 ; i < p_item->i_categories ; i++) { NSString * name = toNSStr(p_item->pp_categories[i]->psz_name); VLCInfoTreeItem * item = [[VLCInfoTreeItem alloc] initWithName:name value:@"" ID:i parent:self]; + + info_category_t * cat = p_item->pp_categories[i]; + NSMutableArray *o_subChilds = [[[NSMutableArray alloc] initWithCapacity: cat->i_infos] autorelease]; + for (int j = 0 ; j < cat->i_infos ; j++) { + NSString * subName = toNSStr(cat->pp_infos[j]->psz_name); + NSString * subValue = toNSStr(cat->pp_infos[j]->psz_value); + VLCInfoTreeItem * subItem = [[VLCInfoTreeItem alloc] initWithName:subName value:subValue ID:j parent:item]; + [subItem autorelease]; + [o_subChilds addObject:subItem]; + } + [item setChildren: o_subChilds]; + [item autorelease]; [o_children addObject:item]; } vlc_mutex_unlock(&p_item->lock); - } - else if (o_parent->i_object_id == -1) { - vlc_mutex_lock(&p_item->lock); - info_category_t * cat = p_item->pp_categories[i_object_id]; - o_children = [[NSMutableArray alloc] initWithCapacity: cat->i_infos]; - for (int i = 0 ; i < cat->i_infos ; i++) { - NSString * name = toNSStr(cat->pp_infos[i]->psz_name); - NSString * value = toNSStr(cat->pp_infos[i]->psz_value); - VLCInfoTreeItem * item = [[VLCInfoTreeItem alloc] initWithName:name value:value ID:i parent:self]; - [item autorelease]; - [o_children addObject:item]; - } - vlc_mutex_unlock(&p_item->lock); - } - else + } else { + // must be item for category info already + assert(o_parent->i_object_id != -1); o_children = IsALeafNode; + } } return o_children; } @@ -508,6 +509,16 @@ error: o_children = nil; } + +- (void)setChildren:(NSMutableArray *)children { + if (o_children && o_children != IsALeafNode) + [o_children release]; + + o_children = children; + [o_children retain]; +} + + - (VLCInfoTreeItem *)childAtIndex:(NSUInteger)i_index { return [[self children] objectAtIndex:i_index]; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
