diff options
author | Max Lohrmann <max@yosemite.local> | 2015-01-13 21:46:54 +0100 |
---|---|---|
committer | Max Lohrmann <max@yosemite.local> | 2015-01-13 21:46:54 +0100 |
commit | e9b8c389a1e2341ff069de8de4305163dfef48b5 (patch) | |
tree | f35e97fcce3c7f2e13e5d26fc738036f4f30a5cd /Source/SPConnectionController.m | |
parent | f2bb1116a22dcbd680a61637532108d0c8497b99 (diff) | |
download | sequelpro-e9b8c389a1e2341ff069de8de4305163dfef48b5.tar.gz sequelpro-e9b8c389a1e2341ff069de8de4305163dfef48b5.tar.bz2 sequelpro-e9b8c389a1e2341ff069de8de4305163dfef48b5.zip |
Change the way the NSOpenPanel is handled when selecting an SSH key to address #2042
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r-- | Source/SPConnectionController.m | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 79a15a19..7cde1e4e 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -371,8 +371,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, #ifndef SP_CODA NSString *directoryPath = nil; NSString *filePath = nil; - keySelectionPanel = [NSOpenPanel openPanel]; - [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; + NSView *accessoryView = nil; // If the button was toggled off, ensure editing is ended if ([sender state] == NSOffState) { @@ -395,7 +394,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, directoryPath = [sshKeyLocation stringByDeletingLastPathComponent]; } - [keySelectionPanel setAccessoryView:sshKeyLocationHelp]; + accessoryView = sshKeyLocationHelp; } // SSL key file location: else if (sender == standardSSLKeyFileButton || sender == socketSSLKeyFileButton || sender == sslOverSSHKeyFileButton) { @@ -404,7 +403,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, return; } - [keySelectionPanel setAccessoryView:sslKeyFileLocationHelp]; + accessoryView = sslKeyFileLocationHelp; } // SSL certificate file location: else if (sender == standardSSLCertificateButton || sender == socketSSLCertificateButton || sender == sslOverSSHCertificateButton) { @@ -413,7 +412,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, return; } - [keySelectionPanel setAccessoryView:sslCertificateLocationHelp]; + accessoryView = sslCertificateLocationHelp; } // SSL CA certificate file location: else if (sender == standardSSLCACertButton || sender == socketSSLCACertButton || sender == sslOverSSHCACertButton) { @@ -422,12 +421,21 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, return; } - [keySelectionPanel setAccessoryView:sslCACertLocationHelp]; + accessoryView = sslCACertLocationHelp; } + + keySelectionPanel = [[NSOpenPanel openPanel] retain]; // retain/release needed on OS X ≤ 10.6 according to Apple doc + [keySelectionPanel setShowsHiddenFiles:[prefs boolForKey:SPHiddenKeyFileVisibilityKey]]; + [keySelectionPanel setAccessoryView:accessoryView]; [keySelectionPanel beginSheetModalForWindow:[dbDocument parentWindow] completionHandler:^(NSInteger returnCode) { NSString *abbreviatedFileName = [[[keySelectionPanel URL] path] stringByAbbreviatingWithTildeInPath]; + + //delay the release so it won't happen while this block is still executing. + dispatch_async(dispatch_get_current_queue(), ^{ + SPClear(keySelectionPanel); + }); // SSH key file selection if (sender == sshSSHKeyButton) { |