Skip to content

Commit feff69b

Browse files
committed
Remove an unbalanced call to -[SPDatabaseDocument endTask] which caused misbehaviour if loading a table failed (fixes #2180)
Note: I suspect this was a leftover from refactoring but I can't rule out the possibility of a code path where this was desired.
1 parent c1580fb commit feff69b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Source/SPDatabaseDocument.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ - (void) endTask
14291429

14301430
// Decrement the working level
14311431
_isWorkingLevel--;
1432+
assert(_isWorkingLevel >= 0);
14321433

14331434
// Ensure cancellation interface is reset
14341435
[self disableTaskCancellation];

Source/SPTableContent.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,14 @@ - (void)loadTable:(NSString *)aTable
314314

315315
// If no table has been supplied, clear the table interface and return
316316
if (!aTable || [aTable isEqualToString:@""]) {
317-
[self performSelectorOnMainThread:@selector(setTableDetails:) withObject:nil waitUntilDone:YES];
318-
317+
[[self onMainThread] setTableDetails:nil];
319318
return;
320319
}
321320

322321
// Attempt to retrieve the table encoding; if that fails (indicating an error occurred
323322
// while retrieving table data), or if the Rows variable is null, clear and return
324323
if (![tableDataInstance tableEncoding] || [[[tableDataInstance statusValues] objectForKey:@"Rows"] isNSNull]) {
325-
[self performSelectorOnMainThread:@selector(setTableDetails:) withObject:nil waitUntilDone:YES];
326-
[tableDocumentInstance performSelectorOnMainThread:@selector(endTask) withObject:nil waitUntilDone:YES];
327-
324+
[[self onMainThread] setTableDetails:nil];
328325
return;
329326
}
330327

@@ -338,7 +335,7 @@ - (void)loadTable:(NSString *)aTable
338335
[tableDataInstance columnNames], @"columnNames",
339336
[tableDataInstance getConstraints], @"constraints",
340337
nil];
341-
[self performSelectorOnMainThread:@selector(setTableDetails:) withObject:tableDetails waitUntilDone:YES];
338+
[[self onMainThread] setTableDetails:tableDetails];
342339

343340
// Init copyTable with necessary information for copying selected rows as SQL INSERT
344341
[tableContentView setTableInstance:self withTableData:tableValues withColumns:dataColumns withTableName:selectedTable withConnection:mySQLConnection];

0 commit comments

Comments
 (0)