From c951e00a06eb2d246634e19542f43dea45651370 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 5 Feb 2013 20:59:54 +0100 Subject: [PATCH] File browser: Dispose all children on collapse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../OakFileBrowser/src/io/FSDirectoryDataSource.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm b/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm index e1957cd1..329a09ea 100644 --- a/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm +++ b/Frameworks/OakFileBrowser/src/io/FSDirectoryDataSource.mm @@ -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; }