diff options
author | Max <post@wickenrode.com> | 2017-03-26 14:56:08 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2017-03-26 14:56:08 +0200 |
commit | 2aad505ec144b83123296c9bc4bad7c0e43753ef (patch) | |
tree | 4943b0cfed29ce14e825b6e11ff4ebd669f9373e /Source | |
parent | 430ff7b0c1df70891a31eb27ba93a5d6b2e1a0d1 (diff) | |
download | sequelpro-2aad505ec144b83123296c9bc4bad7c0e43753ef.tar.gz sequelpro-2aad505ec144b83123296c9bc4bad7c0e43753ef.tar.bz2 sequelpro-2aad505ec144b83123296c9bc4bad7c0e43753ef.zip |
Fix an issue where the wrong table could be deleted when switching tables (by key press) fast enough after confirming deletion (#2742)
This was caused by the delete code being called via a `performSelector:…` timer event instead of directly, which gave the run loop a chance to handle the key event between confirming the delete and actually executing it.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTablesList.m | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index c9c60908..2fa26229 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -65,7 +65,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; @interface SPTablesList () -- (void)_removeTable:(NSNumber *)force; +- (void)_removeTable:(BOOL)force; - (void)_truncateTable; - (void)_addTable; - (void)_copyTable; @@ -730,9 +730,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; } else if ([contextInfo isEqualToString:SPRemoveTable]) { if (returnCode == NSAlertDefaultReturn) { - [self performSelector:@selector(_removeTable:) - withObject:[NSNumber numberWithInteger:[[(NSAlert *)sheet suppressionButton] state]] - afterDelay:0.0]; + [self _removeTable:([[(NSAlert *)sheet suppressionButton] state] == NSOnState)]; } } #ifndef SP_CODA @@ -2185,7 +2183,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; /** * Removes the selected object (table, view, procedure, function, etc.) from the database and tableView. */ -- (void)_removeTable:(NSNumber *)force +- (void)_removeTable:(BOOL)force { NSIndexSet *indexes = [tablesListView selectedRowIndexes]; @@ -2194,7 +2192,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; // Get last index NSUInteger currentIndex = [indexes lastIndex]; - if ([force boolValue]) { + if (force) { [mySQLConnection queryString:@"SET FOREIGN_KEY_CHECKS = 0"]; } @@ -2274,7 +2272,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; } } - if ([force boolValue]) { + if (force) { [mySQLConnection queryString:@"SET FOREIGN_KEY_CHECKS = 1"]; } |