Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 feff69b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions Source/SPDatabaseDocument.m
Expand Up @@ -1429,6 +1429,7 @@ - (void) endTask

// Decrement the working level
_isWorkingLevel--;
assert(_isWorkingLevel >= 0);

// Ensure cancellation interface is reset
[self disableTaskCancellation];
Expand Down
9 changes: 3 additions & 6 deletions Source/SPTableContent.m
Expand Up @@ -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;
}

Expand All @@ -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];
Expand Down

0 comments on commit feff69b

Please sign in to comment.