mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Fix emergency exception when trying to call DeleteCurrentKey without session path, which is reset by MessageDialog() in some cases. Closes #168.
This commit is contained in:
@@ -7261,13 +7261,17 @@ end;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user