Skip to content
Permalink
Browse files

Fix emergency exception when trying to call DeleteCurrentKey without …

…session path, which is reset by MessageDialog() in some cases. Closes #168.
  • Loading branch information...
ansgarbecker committed May 3, 2019
1 parent 0c35a27 commit 32b0dfceb2f682c61f0062ab3059dfae2e13520e
Showing with 6 additions and 2 deletions.
  1. +6 −2 source/main.pas
@@ -7261,13 +7261,17 @@ procedure TMainForm.menuExploreClick(Sender: TObject);
procedure TMainForm.menuClearQueryHistoryClick(Sender: TObject);
var
Values: TStringList;
PathToDelete: String;
begin
// Clear query history items in registry
AppSettings.SessionPath := ActiveConnection.Parameters.SessionPath + '\' + REGKEY_QUERYHISTORY;
// Take care of MessageDialog, probably changing the current SessionPath
PathToDelete := ActiveConnection.Parameters.SessionPath + '\' + REGKEY_QUERYHISTORY;
AppSettings.SessionPath := PathToDelete;
Values := AppSettings.GetValueNames;
if MessageDialog(_('Clear query history?'), f_('%s history items will be deleted.', [FormatNumber(Values.Count)]), mtConfirmation, [mbYes, mbNo]) = mrYes then begin
Screen.Cursor := crHourglass;
AppSettings.DeleteCurrentKey;;
AppSettings.SessionPath := PathToDelete;
AppSettings.DeleteCurrentKey;
RefreshHelperNode(HELPERNODE_HISTORY);
Screen.Cursor := crDefault;
end;

0 comments on commit 32b0dfc

Please sign in to comment.
You can’t perform that action at this time.