Skip to content

Commit 9527a67

Browse files
committed
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.
1 parent db0335a commit 9527a67

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Source/SPDatabaseDocument.m

+9-6
Original file line numberDiff line numberDiff line change
@@ -4468,6 +4468,7 @@ - (void)tabDidResize
44684468
{
44694469
// Coax the main split view into actually checking its constraints
44704470
[contentViewSplitter setPosition:[[[contentViewSplitter subviews] objectAtIndex:0] bounds].size.width ofDividerAtIndex:0];
4471+
44714472
// If the task interface is visible, and this tab is frontmost, re-center the task child window
44724473
if (_isWorkingLevel && [parentWindowController selectedTableDocument] == self) [self centerTaskWindow];
44734474
}
@@ -4476,17 +4477,19 @@ - (void)tabDidResize
44764477
/**
44774478
* Set the parent window
44784479
*/
4479-
- (void)setParentWindow:(NSWindow *)aWindow
4480+
- (void)setParentWindow:(NSWindow *)window
44804481
{
4481-
#ifndef SP_CODA
4482+
NSWindow *outlineViewWindow = [(NSView *)[connectionController favoritesOutlineView] window];
4483+
44824484
// If the window is being set for the first time - connection controller is visible - update focus
4483-
if (!parentWindow && !mySQLConnection) {
4484-
[aWindow makeFirstResponder:(NSResponder *)[connectionController favoritesOutlineView]];
4485+
if (!parentWindow && !mySQLConnection && window == outlineViewWindow) {
4486+
[window makeFirstResponder:(NSResponder *)[connectionController favoritesOutlineView]];
44854487
}
4486-
#endif
44874488

4488-
parentWindow = aWindow;
4489+
parentWindow = window;
4490+
44894491
SPSSHTunnel *currentTunnel = [connectionController valueForKeyPath:@"sshTunnel"];
4492+
44904493
if (currentTunnel) [currentTunnel setParentWindow:parentWindow];
44914494
}
44924495

0 commit comments

Comments
 (0)