aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-02-19 23:49:42 +0000
committerrowanbeentje <rowan@beent.je>2011-02-19 23:49:42 +0000
commit877d17d13ed242203393a4cf3d35231674bcb78a (patch)
tree71b1f2e7cd70dd9f37dcff0eec1d21b7eff1fab1 /Source
parent82c9827989cef9342a42496e40c40ff8f2531448 (diff)
downloadsequelpro-877d17d13ed242203393a4cf3d35231674bcb78a.tar.gz
sequelpro-877d17d13ed242203393a4cf3d35231674bcb78a.tar.bz2
sequelpro-877d17d13ed242203393a4cf3d35231674bcb78a.zip
- Fix spinlocks when table/database deletion causes the table information class to trigger a requery of current state information. This addresses Issue #985.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableData.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index c63d10ff..7ae8f563 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -387,7 +387,11 @@
tableData = [self informationForTable:[tableListInstance tableName]];
}
+ // If nil is returned, return failure.
if (tableData == nil ) {
+
+ // The table information fetch may have already unlocked the data lock.
+ pthread_mutex_trylock(&dataProcessingLock);
pthread_mutex_unlock(&dataProcessingLock);
return FALSE;
}
@@ -487,8 +491,13 @@
nil, nil, [NSApp mainWindow], self, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"An error occurred while retrieving the information for table '%@'. Please try again.\n\nMySQL said: %@", @"error retrieving table information informative message"),
tableName, [mySQLConnection getLastErrorMessage]]);
+
// If the current table doesn't exist anymore reload table list
if([mySQLConnection getLastErrorID] == 1146) {
+
+ // Release the table loading lock to allow reselection/reloading to requery the database.
+ pthread_mutex_unlock(&dataProcessingLock);
+
[[tableListInstance valueForKeyPath:@"tablesListView"] deselectAll:nil];
[tableListInstance updateTables:self];
}