File browser: Dispose all children on collapse

Previously we kept the children which had been expanded, as these had an associated record for tracking file system changes and SCM info.

However, when expanding we weren’t actually re-using the item from the cached record, so not only was this wasteful, but it caused a problem because we effectively created a new item but used the old record with the old item, and while the two items would compare is equal when using isEqualTo:, they didn’t have the same memory address, so the outline view would not consider them equal, and would thus not react on reload requests when using the older item.
This commit is contained in:
Allan Odgaard
2013-02-05 20:59:54 +01:00
parent 032cb19320
commit c951e00a06

View File

@@ -330,7 +330,17 @@ private:
if(visibleItems.find(to_s([anItem.url path])) == visibleItems.end())
NSLog(@"%s %@, item not loaded", sel_getName(_cmd), anItem);
visibleItems.erase(to_s([anItem.url path]));
NSMutableArray* children = [NSMutableArray arrayWithObject:anItem];
for(NSUInteger i = 0; i < children.count; ++i)
{
for(FSItem* item in [children[i] children])
{
if(item.children)
[children addObject:item];
}
}
[self lostItems:children];
anItem.children = nil;
return YES;
}