Permalink
Browse files

Fix a potential memory management / multi threading issue (#2513)

  • Loading branch information...
dmoagx committed Jul 12, 2016
1 parent 7f8e159 commit d1321478bd7334437a853bca3c5202000de1a2d5
Showing with 7 additions and 2 deletions.
  1. +7 −2 Source/SPTablesList.m
@@ -59,6 +59,7 @@
#import "SPSplitView.h"
#endif
#import "SPThreadAdditions.h"
#import "SPFunctions.h"
#ifdef SP_CODA
#import "SQLSidebarViewController.h"
@@ -208,8 +209,12 @@ - (IBAction)updateTables:(nullable id)sender
[[tablesListView onMainThread] deselectAll:self];
tableListIsSelectable = previousTableListIsSelectable;
#endif
[tables removeAllObjects];
[tableTypes removeAllObjects];
SPMainQSync(^{
//this has to be executed en-block on the main queue, otherwise the table view might have a chance to access released memory before we tell it to throw away everything.
[tables removeAllObjects];
[tableTypes removeAllObjects];
[tablesListView reloadData];
});
if ([tableDocumentInstance database]) {

0 comments on commit d132147

Please sign in to comment.