Permalink
Browse files

Fix a data corruption issue in custom query editor (fixes #2113)

... which occurred if ALL of the following conditions were met:
* A cell of a custom query result was being edited
* At the same time another process removed said row
* The custom query was rerun without canceling or finishing the edit first
(also added a NSBeep() for a certain tooltip error message)
  • Loading branch information...
dmoagx committed May 14, 2015
1 parent 6afd525 commit dfcbabf42c877ba6b5d626d02095d34559e5fee2
Showing with 20 additions and 13 deletions.
  1. +20 −13 Source/SPCustomQuery.m
View
@@ -563,6 +563,9 @@ - (void)performQueries:(NSArray *)queries withCallback:(SEL)customQueryCallbackM
{
NSString *taskString;
//ensure there is no pending edit, which could be messed up (#2113)
[[tableDocumentInstance parentWindow] endEditingFor:nil];
if ([queries count] > 1) {
taskString = [NSString stringWithFormat:NSLocalizedString(@"Running query %i of %lu...", @"Running multiple queries string"), 1, (unsigned long)[queries count]];
}
@@ -3822,27 +3825,31 @@ - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)aFieldEdit
pos.y -= 20;
switch(numberOfPossibleUpdateRows) {
case -1:
[SPTooltip showWithObject:kCellEditorErrorNoMultiTabDb
atLocation:pos
ofType:@"text"];
shouldBeginEditing = NO;
NSBeep();
[SPTooltip showWithObject:kCellEditorErrorNoMultiTabDb
atLocation:pos
ofType:@"text"];
shouldBeginEditing = NO;
break;
case 0:
[SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorNoMatch, [columnDefinition objectForKey:@"org_table"]]
atLocation:pos
ofType:@"text"];
shouldBeginEditing = NO;
NSBeep();
[SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorNoMatch, [columnDefinition objectForKey:@"org_table"]]
atLocation:pos
ofType:@"text"];
shouldBeginEditing = NO;
break;
case 1:
shouldBeginEditing = YES;
shouldBeginEditing = YES;
break;
default:
[SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorTooManyMatches, (long)numberOfPossibleUpdateRows]
atLocation:pos
ofType:@"text"];
shouldBeginEditing = NO;
NSBeep();
[SPTooltip showWithObject:[NSString stringWithFormat:kCellEditorErrorTooManyMatches, (long)numberOfPossibleUpdateRows]
atLocation:pos
ofType:@"text"];
shouldBeginEditing = NO;
}
isFieldEditable = shouldBeginEditing;

0 comments on commit dfcbabf

Please sign in to comment.