diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-04-21 01:17:16 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-04-21 01:17:16 +0200 |
commit | 5a531bc5343f35ce5396b21bd707174f3477fb71 (patch) | |
tree | db0ff7941b26996dab83834d3d944a64f810adaa | |
parent | 898ec8e4284a30caf2901ebc613c1cc9d5231e38 (diff) | |
download | sequelpro-5a531bc5343f35ce5396b21bd707174f3477fb71.tar.gz sequelpro-5a531bc5343f35ce5396b21bd707174f3477fb71.tar.bz2 sequelpro-5a531bc5343f35ce5396b21bd707174f3477fb71.zip |
Fix a race reported by ThreadSanitizer
-rw-r--r-- | Source/SPTableContent.m | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 72bdb8e1..b928118f 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -985,11 +985,13 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Update the rows count as necessary [self updateNumberOfRows]; - // Set the filter text - [self updateCountText]; - - // Update pagination - [[self onMainThread] updatePaginationState]; + SPMainQSync(^{ + // Set the filter text + [self updateCountText]; + + // Update pagination + [self updatePaginationState]; + }); // Retrieve and cache the column definitions for editing views if (cqColumnDefinition) [cqColumnDefinition release]; @@ -1163,6 +1165,8 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper /** * Update the table count/selection text + * + * MUST BE CALLED ON THE UI THREAD! */ - (void)updateCountText { @@ -1208,7 +1212,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper } // If rows are selected, append selection count - NSInteger selectedRows = [[tableContentView onMainThread] numberOfSelectedRows]; // -numberOfSelectedRows is a UI method! + NSInteger selectedRows = [tableContentView numberOfSelectedRows]; // -numberOfSelectedRows is a UI method! if (selectedRows > 0) { [countString appendString:@"; "]; if (selectedRows == 1) @@ -1219,7 +1223,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper } #ifndef SP_CODA - [[countText onMainThread] setStringValue:countString]; + [countText setStringValue:countString]; #endif } |