mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 08:20:31 +01:00
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:
parent
8df83a3209
commit
380a764b8c
@ -91,7 +91,8 @@ end;
|
|||||||
procedure TProcessDebugger.ProcessDestroyed(Sender: TObject);
|
procedure TProcessDebugger.ProcessDestroyed(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FProcess := nil;
|
FProcess := nil;
|
||||||
SetState(dsStop);
|
if State <> dsIdle then
|
||||||
|
SetState(dsStop);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProcessDebugger.ProcessEnvironment(const AVariable: String; const ASet: Boolean): Boolean;
|
function TProcessDebugger.ProcessEnvironment(const AVariable: String; const ASet: Boolean): Boolean;
|
||||||
@ -111,8 +112,12 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
SetState(dsInit);
|
||||||
FProcess := TDBGProcess.Create(nil);
|
FProcess := TDBGProcess.Create(nil);
|
||||||
try
|
try
|
||||||
|
TDBGProcess(FProcess).OnDestroy := @ProcessDestroyed;
|
||||||
|
GetDefaultProcessList.Add(FProcess);
|
||||||
|
|
||||||
FProcess.CommandLine := '"'+FileName + '" ' + Arguments;
|
FProcess.CommandLine := '"'+FileName + '" ' + Arguments;
|
||||||
FProcess.CurrentDirectory := WorkingDir;
|
FProcess.CurrentDirectory := WorkingDir;
|
||||||
FProcess.Environment.Assign(Environment);
|
FProcess.Environment.Assign(Environment);
|
||||||
@ -120,13 +125,12 @@ begin
|
|||||||
then FProcess.Options:= [poNewConsole]
|
then FProcess.Options:= [poNewConsole]
|
||||||
else FProcess.Options:= [poNoConsole];
|
else FProcess.Options:= [poNoConsole];
|
||||||
FProcess.ShowWindow := swoShowNormal;
|
FProcess.ShowWindow := swoShowNormal;
|
||||||
TDBGProcess(FProcess).OnDestroy := @ProcessDestroyed;
|
|
||||||
FProcess.Execute;
|
FProcess.Execute;
|
||||||
GetDefaultProcessList.Add(FProcess);
|
|
||||||
except
|
except
|
||||||
on E: exception do begin
|
on E: exception do begin
|
||||||
MessageDlg('Debugger', Format('Exception while creating process: %s', [E.Message]), mtError, [mbOK], 0);
|
MessageDlg('Debugger', Format('Exception while creating process: %s', [E.Message]), mtError, [mbOK], 0);
|
||||||
Result := False;
|
Result := False;
|
||||||
|
SetState(dsIdle);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user