mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Crash on start with corrupted doublecmd.xml (issue #2430)
(cherry picked from commit d1623e070d)
This commit is contained in:
parent
1c1be9e27e
commit
aa16eef676
2 changed files with 28 additions and 8 deletions
|
|
@ -195,6 +195,7 @@ begin
|
|||
LoadWindowsSpecialDir; // Load the list with special path. *Must* be located AFTER "LoadPaths" and BEFORE "InitGlobs"
|
||||
|
||||
if InitGlobs then
|
||||
begin
|
||||
//-- NOTE: before, only IsInstanceAllowed was called, and all the magic on creation
|
||||
// new instance or sending params to the existing server happened inside
|
||||
// IsInstanceAllowed() function as a side effect.
|
||||
|
|
@ -238,7 +239,7 @@ begin
|
|||
begin
|
||||
DCDebug('Another instance of DC is already running. Exiting.');
|
||||
end;
|
||||
|
||||
end;
|
||||
uKeyboard.CleanupKeyboard;
|
||||
DCDebug('Finished Double Commander');
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -742,7 +742,7 @@ uses
|
|||
uGlobsPaths, uLng, uShowMsg, uFileProcs, uOSUtils, uFindFiles, uEarlyConfig,
|
||||
dmHigh, uDCUtils, fMultiRename, uDCVersion, uDebug, uFileFunctions,
|
||||
uDefaultPlugins, Lua, uKeyboard, DCOSUtils, DCStrUtils, uPixMapManager,
|
||||
FileUtil, uSynDiffControls
|
||||
FileUtil, uSynDiffControls, InterfaceBase
|
||||
{$IF DEFINED(MSWINDOWS)}
|
||||
, ShlObj
|
||||
{$ENDIF}
|
||||
|
|
@ -843,14 +843,30 @@ begin
|
|||
end;
|
||||
|
||||
function AskUserOnError(var ErrorMessage: String): Boolean;
|
||||
var
|
||||
Button: TDialogButton;
|
||||
Buttons: TDialogButtons;
|
||||
begin
|
||||
// Show error messages.
|
||||
if ErrorMessage <> EmptyStr then
|
||||
begin
|
||||
Result := QuestionDlg(Application.Title + ' - ' + rsMsgErrorLoadingConfiguration,
|
||||
ErrorMessage, mtWarning,
|
||||
[1, rsDlgButtonContinue, 'isdefault',
|
||||
2, rsDlgButtonExitProgram], 0) = 1;
|
||||
Buttons:= TDialogButtons.Create(TDialogButton);
|
||||
try
|
||||
Button:= Buttons.Add;
|
||||
Button.Default:= True;
|
||||
Button.ModalResult:= mrOK;
|
||||
Button.Caption:= rsDlgButtonContinue;
|
||||
|
||||
Button:= Buttons.Add;
|
||||
Button.Cancel:= True;
|
||||
Button.ModalResult:= mrAbort;
|
||||
Button.Caption:= rsDlgButtonExitProgram;
|
||||
|
||||
Result := DefaultQuestionDialog(Application.Title + ' - ' + rsMsgErrorLoadingConfiguration,
|
||||
ErrorMessage, idDialogWarning, Buttons, 0) = mrOK;
|
||||
finally
|
||||
Buttons.Free;
|
||||
end;
|
||||
// Reset error message.
|
||||
ErrorMessage := '';
|
||||
end
|
||||
|
|
@ -2267,8 +2283,11 @@ begin
|
|||
begin
|
||||
if mbFileAccess(gpGlobalCfgDir + 'doublecmd.xml', fmOpenRead or fmShareDenyWrite) then
|
||||
begin
|
||||
LoadConfigCheckErrors(@LoadGlobalConfig, gpGlobalCfgDir + 'doublecmd.xml', ErrorMessage);
|
||||
if gConfig.TryGetValue(gConfig.RootNode, 'Configuration/UseConfigInProgramDir', gUseConfigInProgramDir) then
|
||||
if not LoadConfigCheckErrors(@LoadGlobalConfig, gpGlobalCfgDir + 'doublecmd.xml', ErrorMessage) then
|
||||
begin
|
||||
if not gUseConfigInProgramDir then ErrorMessage := EmptyStr;
|
||||
end
|
||||
else if gConfig.TryGetValue(gConfig.RootNode, 'Configuration/UseConfigInProgramDir', gUseConfigInProgramDir) then
|
||||
begin
|
||||
gConfig.DeleteNode(gConfig.RootNode, 'Configuration/UseConfigInProgramDir');
|
||||
if not gUseConfigInProgramDir then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue