Permalink
Browse files

Remove an unbalanced call to -[SPDatabaseDocument endTask] which caus…

…ed 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.
  • Loading branch information...
dmoagx committed Jul 19, 2015
1 parent c1580fb commit feff69bdf2cb1148dc2930a9de7976c80c939632
Showing with 4 additions and 6 deletions.
  1. +1 −0 Source/SPDatabaseDocument.m
  2. +3 −6 Source/SPTableContent.m
@@ -1429,6 +1429,7 @@ - (void) endTask
// Decrement the working level
_isWorkingLevel--;
assert(_isWorkingLevel >= 0);
// Ensure cancellation interface is reset
[self disableTaskCancellation];
View
@@ -314,17 +314,14 @@ - (void)loadTable:(NSString *)aTable
// If no table has been supplied, clear the table interface and return
if (!aTable || [aTable isEqualToString:@""]) {
[self performSelectorOnMainThread:@selector(setTableDetails:) withObject:nil waitUntilDone:YES];
[[self onMainThread] setTableDetails:nil];
return;
}
// Attempt to retrieve the table encoding; if that fails (indicating an error occurred
// while retrieving table data), or if the Rows variable is null, clear and return
if (![tableDataInstance tableEncoding] || [[[tableDataInstance statusValues] objectForKey:@"Rows"] isNSNull]) {
[self performSelectorOnMainThread:@selector(setTableDetails:) withObject:nil waitUntilDone:YES];
[tableDocumentInstance performSelectorOnMainThread:@selector(endTask) withObject:nil waitUntilDone:YES];
[[self onMainThread] setTableDetails:nil];
return;
}
@@ -338,7 +335,7 @@ - (void)loadTable:(NSString *)aTable
[tableDataInstance columnNames], @"columnNames",
[tableDataInstance getConstraints], @"constraints",
nil];
[self performSelectorOnMainThread:@selector(setTableDetails:) withObject:tableDetails waitUntilDone:YES];
[[self onMainThread] setTableDetails:tableDetails];
// Init copyTable with necessary information for copying selected rows as SQL INSERT
[tableContentView setTableInstance:self withTableData:tableValues withColumns:dataColumns withTableName:selectedTable withConnection:mySQLConnection];

0 comments on commit feff69b

Please sign in to comment.