From 9527a670cf2ea0f05312a09bd4def0721254e0ae Mon Sep 17 00:00:00 2001 From: Stuart Connolly Date: Thu, 30 Mar 2017 22:18:03 +0100 Subject: Fix first responder exception being logged on 10.12. Check if the favourites outline view is attached to a window before setting it as the first responder. --- Source/SPDatabaseDocument.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index bc1acb22..6fa097c1 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4468,6 +4468,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; { // Coax the main split view into actually checking its constraints [contentViewSplitter setPosition:[[[contentViewSplitter subviews] objectAtIndex:0] bounds].size.width ofDividerAtIndex:0]; + // If the task interface is visible, and this tab is frontmost, re-center the task child window if (_isWorkingLevel && [parentWindowController selectedTableDocument] == self) [self centerTaskWindow]; } @@ -4476,17 +4477,19 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; /** * Set the parent window */ -- (void)setParentWindow:(NSWindow *)aWindow +- (void)setParentWindow:(NSWindow *)window { -#ifndef SP_CODA + NSWindow *outlineViewWindow = [(NSView *)[connectionController favoritesOutlineView] window]; + // If the window is being set for the first time - connection controller is visible - update focus - if (!parentWindow && !mySQLConnection) { - [aWindow makeFirstResponder:(NSResponder *)[connectionController favoritesOutlineView]]; + if (!parentWindow && !mySQLConnection && window == outlineViewWindow) { + [window makeFirstResponder:(NSResponder *)[connectionController favoritesOutlineView]]; } -#endif - parentWindow = aWindow; + parentWindow = window; + SPSSHTunnel *currentTunnel = [connectionController valueForKeyPath:@"sshTunnel"]; + if (currentTunnel) [currentTunnel setParentWindow:parentWindow]; } -- cgit v1.2.3 From 63eb8781018c094644bc1d46099b42ad27f51670 Mon Sep 17 00:00:00 2001 From: Stuart Connolly Date: Thu, 30 Mar 2017 22:18:49 +0100 Subject: Fix first responder exception being logged on 10.12. Check if the favourites outline view is attached to a window before setting it as the first responder. --- Source/SPDatabaseDocument.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 6fa097c1..c38aae5a 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4479,10 +4479,10 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; */ - (void)setParentWindow:(NSWindow *)window { - NSWindow *outlineViewWindow = [(NSView *)[connectionController favoritesOutlineView] window]; + NSWindow *favoritesOutlineViewWindow = [(NSView *)[connectionController favoritesOutlineView] window]; // If the window is being set for the first time - connection controller is visible - update focus - if (!parentWindow && !mySQLConnection && window == outlineViewWindow) { + if (!parentWindow && !mySQLConnection && window == favoritesOutlineViewWindow) { [window makeFirstResponder:(NSResponder *)[connectionController favoritesOutlineView]]; } -- cgit v1.2.3