Skip to content

Commit 5a531bc

Browse files
committed
Fix a race reported by ThreadSanitizer
1 parent 898ec8e commit 5a531bc

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Source/SPTableContent.m

+11-7
Original file line numberDiff line numberDiff line change
@@ -985,11 +985,13 @@ - (void) loadTableValues
985985
// Update the rows count as necessary
986986
[self updateNumberOfRows];
987987

988-
// Set the filter text
989-
[self updateCountText];
990-
991-
// Update pagination
992-
[[self onMainThread] updatePaginationState];
988+
SPMainQSync(^{
989+
// Set the filter text
990+
[self updateCountText];
991+
992+
// Update pagination
993+
[self updatePaginationState];
994+
});
993995

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

11641166
/**
11651167
* Update the table count/selection text
1168+
*
1169+
* MUST BE CALLED ON THE UI THREAD!
11661170
*/
11671171
- (void)updateCountText
11681172
{
@@ -1208,7 +1212,7 @@ - (void)updateCountText
12081212
}
12091213

12101214
// If rows are selected, append selection count
1211-
NSInteger selectedRows = [[tableContentView onMainThread] numberOfSelectedRows]; // -numberOfSelectedRows is a UI method!
1215+
NSInteger selectedRows = [tableContentView numberOfSelectedRows]; // -numberOfSelectedRows is a UI method!
12121216
if (selectedRows > 0) {
12131217
[countString appendString:@"; "];
12141218
if (selectedRows == 1)
@@ -1219,7 +1223,7 @@ - (void)updateCountText
12191223
}
12201224

12211225
#ifndef SP_CODA
1222-
[[countText onMainThread] setStringValue:countString];
1226+
[countText setStringValue:countString];
12231227
#endif
12241228
}
12251229

0 commit comments

Comments
 (0)