From 8fcdb7bcc6dedb7af9b1a7829a83cdc2fca54f4b Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 16 May 2017 00:29:21 +0200 Subject: Fix an erroneous check that would allow to close windows with only one tab even when it was busy (#2787) --- Source/SPWindowControllerDelegate.m | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'Source/SPWindowControllerDelegate.m') diff --git a/Source/SPWindowControllerDelegate.m b/Source/SPWindowControllerDelegate.m index 79b1e2f1..009dc0a4 100644 --- a/Source/SPWindowControllerDelegate.m +++ b/Source/SPWindowControllerDelegate.m @@ -56,15 +56,11 @@ */ - (BOOL)windowShouldClose:(id)sender { - // Iterate through all tabs if more than one tab is opened only otherwise - // [... parentTabShouldClose] will be called twice [see self closeTab:(id)sender] - if ([[tabView tabViewItems] count] > 1) { - for (NSTabViewItem *eachItem in [tabView tabViewItems]) - { - SPDatabaseDocument *eachDocument = [eachItem identifier]; - - if (![eachDocument parentTabShouldClose]) return NO; - } + for (NSTabViewItem *eachItem in [tabView tabViewItems]) + { + SPDatabaseDocument *eachDocument = [eachItem identifier]; + + if (![eachDocument parentTabShouldClose]) return NO; } // Remove global session data if the last window of a session will be closed @@ -190,6 +186,8 @@ /** * Called to determine whether a tab view item can be closed + * + * Note: This is ONLY called when using the "X" button on the tab itself. */ - (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem { -- cgit v1.2.3