Fix IDE does not end debugger state (processdebugger / dbg=none), if exe can not be started. issue #0024809

git-svn-id: trunk@42358 -
This commit is contained in:
martin 2013-08-05 19:13:44 +00:00
parent 8df83a3209
commit 380a764b8c

View File

@ -91,7 +91,8 @@ end;
procedure TProcessDebugger.ProcessDestroyed(Sender: TObject);
begin
FProcess := nil;
SetState(dsStop);
if State <> dsIdle then
SetState(dsStop);
end;
function TProcessDebugger.ProcessEnvironment(const AVariable: String; const ASet: Boolean): Boolean;
@ -111,8 +112,12 @@ begin
Exit;
end;
SetState(dsInit);
FProcess := TDBGProcess.Create(nil);
try
TDBGProcess(FProcess).OnDestroy := @ProcessDestroyed;
GetDefaultProcessList.Add(FProcess);
FProcess.CommandLine := '"'+FileName + '" ' + Arguments;
FProcess.CurrentDirectory := WorkingDir;
FProcess.Environment.Assign(Environment);
@ -120,13 +125,12 @@ begin
then FProcess.Options:= [poNewConsole]
else FProcess.Options:= [poNoConsole];
FProcess.ShowWindow := swoShowNormal;
TDBGProcess(FProcess).OnDestroy := @ProcessDestroyed;
FProcess.Execute;
GetDefaultProcessList.Add(FProcess);
except
on E: exception do begin
MessageDlg('Debugger', Format('Exception while creating process: %s', [E.Message]), mtError, [mbOK], 0);
Result := False;
SetState(dsIdle);
Exit;
end;
end;