mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 19:39:28 +02:00
FpDebug: Fixed MemLeak on Windows: TProcessUtf8 was not freed / introduced in e104c4c418
- merge-request !41
This commit is contained in:
parent
7c0fdd1281
commit
9213ca32e8
@ -660,23 +660,22 @@ function TDbgWinProcess.StartInstance(AParams, AnEnvironment: TStrings;
|
|||||||
AWorkingDirectory, AConsoleTty: string; AFlags: TStartInstanceFlags; out
|
AWorkingDirectory, AConsoleTty: string; AFlags: TStartInstanceFlags; out
|
||||||
AnError: TFpError): boolean;
|
AnError: TFpError): boolean;
|
||||||
var
|
var
|
||||||
AProcess: TProcessUTF8;
|
|
||||||
LastErr: Integer;
|
LastErr: Integer;
|
||||||
begin
|
begin
|
||||||
result := false;
|
result := false;
|
||||||
AProcess := TProcessUTF8.Create(nil);
|
FProcProcess := TProcessUTF8.Create(nil);
|
||||||
try
|
try
|
||||||
// To debug sub-processes, this needs to be poDebugProcess
|
// To debug sub-processes, this needs to be poDebugProcess
|
||||||
AProcess.Options:=[poDebugProcess, poDebugOnlyThisProcess, poNewProcessGroup];
|
FProcProcess.Options:=[poDebugProcess, poDebugOnlyThisProcess, poNewProcessGroup];
|
||||||
if siForceNewConsole in AFlags then
|
if siForceNewConsole in AFlags then
|
||||||
AProcess.Options:=AProcess.Options+[poNewConsole];
|
FProcProcess.Options:=FProcProcess.Options+[poNewConsole];
|
||||||
AProcess.Executable:=Name;
|
FProcProcess.Executable:=Name;
|
||||||
AProcess.Parameters:=AParams;
|
FProcProcess.Parameters:=AParams;
|
||||||
AProcess.Environment:=AnEnvironment;
|
FProcProcess.Environment:=AnEnvironment;
|
||||||
AProcess.CurrentDirectory:=AWorkingDirectory;
|
FProcProcess.CurrentDirectory:=AWorkingDirectory;
|
||||||
AProcess.Execute;
|
FProcProcess.Execute;
|
||||||
|
|
||||||
Init(AProcess.ProcessID, 0);
|
Init(FProcProcess.ProcessID, 0);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
except
|
except
|
||||||
on E: Exception do
|
on E: Exception do
|
||||||
@ -691,7 +690,7 @@ begin
|
|||||||
else
|
else
|
||||||
{$endif i386}
|
{$endif i386}
|
||||||
AnError := CreateError(fpErrCreateProcess, [Name, LastErr, E.Message, '']);
|
AnError := CreateError(fpErrCreateProcess, [Name, LastErr, E.Message, '']);
|
||||||
AProcess.Free;
|
FreeAndNil(FProcProcess);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user