From d99de6f4c04fa0da1575963d161182c92cf3721f Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 26 Aug 2013 22:45:05 +0000 Subject: - Fix occasional exceptions when saves of new fields in the table structure fail (http://spbug.com/l/2500, http://spbug.com/l/2281, http://spbug.com/l/2046) --- Source/SPTableStructure.m | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Source/SPTableStructure.m') diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index f5879f4e..cd034a6d 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -683,13 +683,6 @@ if (!isEditingRow || isSavingRow) return YES; isSavingRow = YES; - // Save any edits which have been made but not saved to the table yet. -#ifndef SP_CODA /* patch */ - [[tableDocumentInstance parentWindow] endEditingFor:nil]; -#else - [[tableSourceView window] endEditingFor:nil]; -#endif - // Attempt to save the row, and return YES if the save succeeded. if ([self addRowToDB]) { isSavingRow = NO; @@ -712,6 +705,12 @@ if (alertSheetOpened) return NO; + // Save any edits which have been started but not saved to the underlying table/data structures + // yet - but not if currently undoing/redoing, as this can cause a processing loop + if (![[[[tableSourceView window] firstResponder] undoManager] isUndoing] && ![[[[tableSourceView window] firstResponder] undoManager] isRedoing]) { + [[tableSourceView window] endEditingFor:nil]; + } + NSMutableString *queryString; BOOL fieldDefIncludesLen = NO; -- cgit v1.2.3