aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPCustomQuery.m13
-rw-r--r--Source/SPTableContent.m8
-rw-r--r--Source/SPTableContentDelegate.m12
3 files changed, 21 insertions, 12 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 15839a7e..c22e5b59 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -2441,6 +2441,12 @@
// Check if the field can identified bijectively
if ( aTableView == customQueryView ) {
+
+ // Nothing is editable while the field editor is running.
+ // This guards against a special case where accessibility services might
+ // check if a table field is editable while the sheet is running.
+ if (fieldEditor) return NO;
+
NSDictionary *columnDefinition = [cqColumnDefinition objectAtIndex:[[aTableColumn identifier] integerValue]];
// Check if current field is a blob
@@ -2450,7 +2456,6 @@
// Open the editing sheet if required
if ([customQueryView shouldUseFieldEditorForRow:rowIndex column:[[aTableColumn identifier] integerValue] checkWithLock:NULL])
{
- if (fieldEditor) SPClear(fieldEditor);
fieldEditor = [[SPFieldEditorController alloc] init];
// Remember edited row for reselecting and setting the scroll view after reload
@@ -3681,9 +3686,9 @@
}
}
- if(fieldEditor) {
- SPClear(fieldEditor);
- }
+ // this is a delegate method of the field editor controller. calling release
+ // now would risk a dealloc while it is still our parent on the stack:
+ [fieldEditor autorelease], fieldEditor = nil;
// Preserve focus and restore selection indexes if appropriate
[[tableDocumentInstance parentWindow] makeFirstResponder:customQueryView];
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 0be238ba..89a73138 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -3363,10 +3363,10 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
}
}
}
-
- if(fieldEditor) {
- SPClear(fieldEditor);
- }
+
+ // this is a delegate method of the field editor controller. calling release
+ // now would risk a dealloc while it is still our parent on the stack:
+ [fieldEditor autorelease], fieldEditor = nil;
[[tableContentView window] makeFirstResponder:tableContentView];
diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m
index 01252d4e..25ea9822 100644
--- a/Source/SPTableContentDelegate.m
+++ b/Source/SPTableContentDelegate.m
@@ -235,6 +235,11 @@
#endif
if (tableView == tableContentView) {
+ // Nothing is editable while the field editor is running.
+ // This guards against a special case where accessibility services might
+ // check if a table field is editable while the sheet is running.
+ if (fieldEditor) return NO;
+
// Ensure that row is editable since it could contain "(not loaded)" columns together with
// issue that the table has no primary key
NSString *wherePart = [NSString stringWithString:[self argumentForRow:[tableContentView selectedRow]]];
@@ -303,8 +308,6 @@
fieldEncoding = [columnDefinition objectForKey:@"charset_name"];
}
- if (fieldEditor) SPClear(fieldEditor);
-
fieldEditor = [[SPFieldEditorController alloc] init];
[fieldEditor setEditedFieldInfo:[NSDictionary dictionaryWithObjectsAndKeys:
@@ -709,8 +712,8 @@
/**
* If the user selected a table cell which is a blob field and tried to edit it
- * cancel the fieldEditor, display the field editor sheet instead for editing
- * and re-enable the fieldEditor after editing.
+ * cancel the inline edit, display the field editor sheet instead for editing
+ * and re-enable inline editing after closing the sheet.
*/
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)aFieldEditor
{
@@ -767,6 +770,7 @@
// Cancel editing
[control abortEditing];
+ NSAssert(fieldEditor == nil, @"Method should not to be called while a field editor sheet is open!");
// Call the field editor sheet
[self tableView:tableContentView shouldEditTableColumn:NSArrayObjectAtIndex([tableContentView tableColumns], column) row:row];