aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-06-05 15:41:52 +0000
committerrowanbeentje <rowan@beent.je>2010-06-05 15:41:52 +0000
commit9131b074138b00e354064410b89b5d14a6ee0c40 (patch)
tree4f5407022b0a0561cc1d46e2f912a6b3b2202c42 /Source
parent3adafb4e0bb38776f71302fd241be3bc677730d7 (diff)
downloadsequelpro-9131b074138b00e354064410b89b5d14a6ee0c40.tar.gz
sequelpro-9131b074138b00e354064410b89b5d14a6ee0c40.tar.bz2
sequelpro-9131b074138b00e354064410b89b5d14a6ee0c40.zip
- Ensure SPTableInfo reloads occur on the main thread, fixing a number of logged exceptions for beyond-bound index accesses
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableContent.m10
-rw-r--r--Source/SPTableInfo.m6
2 files changed, 11 insertions, 5 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index a03e17a7..de827982 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2667,8 +2667,8 @@
maxNumRowsIsEstimate = NO;
[tableDataInstance setStatusValue:[NSString stringWithFormat:@"%ld", (long)maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
- [tableInfoInstance tableChanged:nil];
- [[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTable waitUntilDone:YES];
+ [[tableInfoInstance onMainThread] tableChanged:nil];
+ [[[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] onMainThread] loadTable:selectedTable];
// Otherwise, if the table status value is accurate, use it
} else if ([[tableDataInstance statusValueForKey:@"RowsCountAccurate"] boolValue]) {
@@ -2686,8 +2686,8 @@
maxNumRowsIsEstimate = NO;
[tableDataInstance setStatusValue:[NSString stringWithFormat:@"%ld", (long)maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
- [tableInfoInstance tableChanged:nil];
- [[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTable waitUntilDone:YES];
+ [[tableInfoInstance onMainThread] tableChanged:nil];
+ [[[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] onMainThread] loadTable:selectedTable];
// Use the estimate count
} else {
@@ -2719,7 +2719,7 @@
}
[tableDataInstance setStatusValue:[NSString stringWithFormat:@"%ld", (long)maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:maxNumRowsIsEstimate?@"n":@"y" forKey:@"RowsCountAccurate"];
- [tableInfoInstance tableChanged:nil];
+ [[tableInfoInstance onMainThread] tableChanged:nil];
}
}
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index e44e8194..00db406e 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -67,6 +67,12 @@
[super dealloc];
}
+/**
+ * Notification to indicate the table has changed and that the table info requires
+ * reloading for display. This is called on table changes, and also (with a nil argument)
+ * during certain refresh operations to trigger a data update.
+ * This function is not thread-safe.
+ */
- (void)tableChanged:(NSNotification *)notification
{
NSDictionary *tableStatus;