aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-11-18 01:03:21 +0000
committerrowanbeentje <rowan@beent.je>2009-11-18 01:03:21 +0000
commit251bc8a52e56fbf240b74d7bfcaf21090bbfe83f (patch)
treee992739c33d2d89f34eb4a30632984c859739810 /Source
parent1c7cf0aa49e68714dbfc4d7ca01fccd519e22aee (diff)
downloadsequelpro-251bc8a52e56fbf240b74d7bfcaf21090bbfe83f.tar.gz
sequelpro-251bc8a52e56fbf240b74d7bfcaf21090bbfe83f.tar.bz2
sequelpro-251bc8a52e56fbf240b74d7bfcaf21090bbfe83f.zip
- Make some thread safety improvements to improve on Issue #460
- Add some NSTextView editing notifications to maintain state correctly in an attempt to fix issue in crash log on comment 9 on #460
Diffstat (limited to 'Source')
-rw-r--r--Source/SPExtendedTableInfo.m24
-rw-r--r--Source/TableContent.m4
2 files changed, 22 insertions, 6 deletions
diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m
index 9a84286e..b2d92a58 100644
--- a/Source/SPExtendedTableInfo.m
+++ b/Source/SPExtendedTableInfo.m
@@ -204,12 +204,19 @@
[tableTypePopUpButton addItemWithTitle:@"View"];
// Set create syntax
[tableCreateSyntaxTextView setEditable:YES];
+ [tableCreateSyntaxTextView shouldChangeTextInRange:NSMakeRange(0, [[tableCreateSyntaxTextView string] length]) replacementString:@""];
[tableCreateSyntaxTextView setString:@""];
- [tableCreateSyntaxTextView insertText:[[tableDataInstance tableCreateSyntax] createViewSyntaxPrettifier]];
+ NSString *createViewSyntax = [[tableDataInstance tableCreateSyntax] createViewSyntaxPrettifier];
+ [tableCreateSyntaxTextView shouldChangeTextInRange:NSMakeRange(0, 0) replacementString:createViewSyntax];
+ [tableCreateSyntaxTextView insertText:createViewSyntax];
+ [tableCreateSyntaxTextView didChangeText];
[tableCreateSyntaxTextView setEditable:NO];
} else {
- [tableCreateSyntaxTextView setEditable:NO];
+ [tableCreateSyntaxTextView setEditable:YES];
+ [tableCreateSyntaxTextView shouldChangeTextInRange:NSMakeRange(0, [[tableCreateSyntaxTextView string] length]) replacementString:@""];
[tableCreateSyntaxTextView setString:@""];
+ [tableCreateSyntaxTextView didChangeText];
+ [tableCreateSyntaxTextView setEditable:NO];
}
[tableCreatedAt setStringValue:@"Created at: "];
@@ -228,8 +235,10 @@
[tableSizeFree setStringValue:@"Free data size: "];
// Set comments
- [tableCommentsTextView setString:@""];
[tableCommentsTextView setEditable:NO];
+ [tableCommentsTextView shouldChangeTextInRange:NSMakeRange(0, [[tableCommentsTextView string] length]) replacementString:@""];
+ [tableCommentsTextView setString:@""];
+ [tableCommentsTextView didChangeText];
return;
}
@@ -304,13 +313,20 @@
[tableSizeFree setStringValue:[self _formatValueWithKey:@"Data_free" inDictionary:statusFields withLabel:@"Free data size"]];
// Set comments
- [tableCommentsTextView setEditable:enableInteraction];
+ [tableCommentsTextView setEditable:YES];
+ [tableCommentsTextView shouldChangeTextInRange:NSMakeRange(0, [[tableCommentsTextView string] length]) replacementString:[statusFields objectForKey:@"Comment"]];
[tableCommentsTextView setString:[statusFields objectForKey:@"Comment"]];
+ [tableCommentsTextView didChangeText];
+ [tableCommentsTextView setEditable:enableInteraction];
// Set create syntax
[tableCreateSyntaxTextView setEditable:YES];
+ [tableCreateSyntaxTextView shouldChangeTextInRange:NSMakeRange(0, [[tableCommentsTextView string] length]) replacementString:@""];
[tableCreateSyntaxTextView setString:@""];
+ [tableCreateSyntaxTextView didChangeText];
+ [tableCreateSyntaxTextView shouldChangeTextInRange:NSMakeRange(0, 0) replacementString:[tableDataInstance tableCreateSyntax]];
[tableCreateSyntaxTextView insertText:[tableDataInstance tableCreateSyntax]];
+ [tableCreateSyntaxTextView didChangeText];
[tableCreateSyntaxTextView setEditable:NO];
}
diff --git a/Source/TableContent.m b/Source/TableContent.m
index fbce4b33..26d2138e 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -2313,7 +2313,7 @@
[tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
[tableInfoInstance tableChanged:nil];
- [[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] loadTable:selectedTable];
+ [[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTable waitUntilDone:YES];
// Otherwise, if the table status value is accurate, use it
} else if ([[tableDataInstance statusValueForKey:@"RowsCountAccurate"] boolValue]) {
@@ -2328,7 +2328,7 @@
[tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
[tableInfoInstance tableChanged:nil];
- [[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] loadTable:selectedTable];
+ [[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTable waitUntilDone:YES];
// Use the estimate count
} else {