aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-05-14 20:13:06 +0200
committerMax <post@wickenrode.com>2015-05-14 20:13:06 +0200
commitdfcbabf42c877ba6b5d626d02095d34559e5fee2 (patch)
tree18c11d30a77a1fac93860e8bd570f1cedac7ba09 /Source/SPCustomQuery.m
parent6afd5253d3162c67012fcf835183a5de0f19b05c (diff)
downloadsequelpro-dfcbabf42c877ba6b5d626d02095d34559e5fee2.tar.gz
sequelpro-dfcbabf42c877ba6b5d626d02095d34559e5fee2.tar.bz2
sequelpro-dfcbabf42c877ba6b5d626d02095d34559e5fee2.zip
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)
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m33
1 files changed, 20 insertions, 13 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 70ff07ff..a6e14b34 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -563,6 +563,9 @@
{
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 @@
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;