From 38d40d03969967a186ec57f86cd257ff4dab9fd0 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 7 Jun 2017 17:58:16 +0200 Subject: Fix an issue that could cause Sequel Pro to become unusable when reloading a table when at the same time editing a cell with a value that is not valid (#2816) --- Source/SPTableContent.m | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Source') diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index aeac9bc4..48871c11 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -1323,20 +1323,21 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper { NSAutoreleasePool *reloadPool = [[NSAutoreleasePool alloc] init]; - // Check whether a save of the current row is required. - if (![[self onMainThread] saveRowOnDeselect]) return; + // Check whether a save of the current row is required, abort if pending changes couldn't be saved. + if ([[self onMainThread] saveRowOnDeselect]) { - // Save view details to restore safely if possible (except viewport, which will be - // preserved automatically, and can then be scrolled as the table loads) - [self storeCurrentDetailsForRestoration]; - [self setViewportToRestore:NSZeroRect]; + // Save view details to restore safely if possible (except viewport, which will be + // preserved automatically, and can then be scrolled as the table loads) + [self storeCurrentDetailsForRestoration]; + [self setViewportToRestore:NSZeroRect]; - // Clear the table data column cache and status (including counts) - [tableDataInstance resetColumnData]; - [tableDataInstance resetStatusData]; + // Clear the table data column cache and status (including counts) + [tableDataInstance resetColumnData]; + [tableDataInstance resetStatusData]; - // Load the table's data - [self loadTable:[tablesListInstance tableName]]; + // Load the table's data + [self loadTable:[tablesListInstance tableName]]; + } [tableDocumentInstance endTask]; -- cgit v1.2.3