From 251bc8a52e56fbf240b74d7bfcaf21090bbfe83f Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 18 Nov 2009 01:03:21 +0000 Subject: - 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 --- Source/SPExtendedTableInfo.m | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'Source/SPExtendedTableInfo.m') 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]; } -- cgit v1.2.3