aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-11-24 02:12:19 +0000
committerrowanbeentje <rowan@beent.je>2009-11-24 02:12:19 +0000
commitc8f01e3d2c987166dab31cc46d4f9827a7dc5f4d (patch)
treeb9577397bc1b67992db4846bf41a513cf78dbd8b /Source
parent6b39013007536d9cad5b958633740f65891c6475 (diff)
downloadsequelpro-c8f01e3d2c987166dab31cc46d4f9827a7dc5f4d.tar.gz
sequelpro-c8f01e3d2c987166dab31cc46d4f9827a7dc5f4d.tar.bz2
sequelpro-c8f01e3d2c987166dab31cc46d4f9827a7dc5f4d.zip
- Fix a couple of thread safety issues in TableContent, and attempt to fix an occasional crasher when getting table cells by adding a retain
- Alter MCPStreamingResult to use pthread mutexes in a further attempt to address Issue #463
Diffstat (limited to 'Source')
-rw-r--r--Source/TableContent.m18
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 679f8e1c..7a6eb9cb 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -467,7 +467,7 @@
}
// Update display if necessary
- [tableContentView displayIfNeeded];
+ [tableContentView performSelectorOnMainThread:@selector(displayIfNeeded) withObject:nil waitUntilDone:NO];
// Init copyTable with necessary information for copying selected rows as SQL INSERT
[tableContentView setTableInstance:self withTableData:tableValues withColumns:dataColumns withTableName:selectedTable withConnection:mySQLConnection];
@@ -1584,10 +1584,10 @@
[item release];
// Update the argumentField enabled state
- [self toggleFilterField:self];
+ [self performSelectorOnMainThread:@selector(toggleFilterField:) withObject:self waitUntilDone:YES];
// set focus on argumentField
- [argumentField selectText:self];
+ [argumentField performSelectorOnMainThread:@selector(selectText:) withObject:self waitUntilDone:YES];
}
@@ -2536,10 +2536,14 @@
// cases - when the load completes all table data will be redrawn.
NSUInteger columnIndex = [[aTableColumn identifier] intValue];
if (rowIndex >= tableRowsCount) return @"...";
- NSMutableArray *rowData = NSArrayObjectAtIndex(tableValues, rowIndex);
- if (rowData && columnIndex >= [rowData count]) return @"...";
+ NSMutableArray *rowData = [NSArrayObjectAtIndex(tableValues, rowIndex) retain];
+ if (!rowData || columnIndex >= [rowData count]) {
+ if (rowData) [rowData release];
+ return @"...";
+ }
id theValue = NSArrayObjectAtIndex(rowData, columnIndex);
+ [rowData release];
if ([theValue isNSNull])
return [prefs objectForKey:SPNullValue];
@@ -2568,13 +2572,15 @@
[cell setTextColor:[NSColor lightGrayColor]];
return;
}
- NSMutableArray *rowData = NSArrayObjectAtIndex(tableValues, rowIndex);
+ NSMutableArray *rowData = [NSArrayObjectAtIndex(tableValues, rowIndex) retain];
if (!rowData || columnIndex >= [rowData count]) {
+ if (rowData) [rowData release];
[cell setTextColor:[NSColor lightGrayColor]];
return;
}
id theValue = NSArrayObjectAtIndex(rowData, columnIndex);
+ [rowData release];
// If user wants to edit 'cell' set text color to black and return to avoid
// writing in gray if value was NULL