Skip to content

Commit

Permalink
Fix a race reported by ThreadSanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoagx committed Apr 20, 2018
1 parent 898ec8e commit 5a531bc
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Source/SPTableContent.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -985,11 +985,13 @@ - (void) loadTableValues
// Update the rows count as necessary // Update the rows count as necessary
[self updateNumberOfRows]; [self updateNumberOfRows];


// Set the filter text SPMainQSync(^{
[self updateCountText]; // Set the filter text

[self updateCountText];
// Update pagination
[[self onMainThread] updatePaginationState]; // Update pagination
[self updatePaginationState];
});


// Retrieve and cache the column definitions for editing views // Retrieve and cache the column definitions for editing views
if (cqColumnDefinition) [cqColumnDefinition release]; if (cqColumnDefinition) [cqColumnDefinition release];
Expand Down Expand Up @@ -1163,6 +1165,8 @@ - (NSString *)tableFilterString


/** /**
* Update the table count/selection text * Update the table count/selection text
*
* MUST BE CALLED ON THE UI THREAD!
*/ */
- (void)updateCountText - (void)updateCountText
{ {
Expand Down Expand Up @@ -1208,7 +1212,7 @@ - (void)updateCountText
} }


// If rows are selected, append selection count // 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) { if (selectedRows > 0) {
[countString appendString:@"; "]; [countString appendString:@"; "];
if (selectedRows == 1) if (selectedRows == 1)
Expand All @@ -1219,7 +1223,7 @@ - (void)updateCountText
} }


#ifndef SP_CODA #ifndef SP_CODA
[[countText onMainThread] setStringValue:countString]; [countText setStringValue:countString];
#endif #endif
} }


Expand Down

0 comments on commit 5a531bc

Please sign in to comment.