mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 23:00:15 +02:00
FpDebug: Refactor freeing thread objects for exited threads
git-svn-id: trunk@62175 -
This commit is contained in:
parent
751d6dd60d
commit
17dda63638
@ -816,7 +816,6 @@ var
|
||||
IsFinished, b: boolean;
|
||||
EventProcess: TDbgProcess;
|
||||
DummyThread: TDbgThread;
|
||||
ctid: Integer;
|
||||
|
||||
begin
|
||||
AExit:=false;
|
||||
@ -842,9 +841,6 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
ctid := 0;
|
||||
if FCurrentThread <> nil then
|
||||
ctid := FCurrentThread.ID;
|
||||
InterLockedExchange(FRunning, 1);
|
||||
// if Pause() is called right here, an Interrupt-Event is scheduled, even though we do not run (yet)
|
||||
if InterLockedExchangeAdd(FPauseRequest, 0) = 1 then begin
|
||||
@ -866,8 +862,8 @@ begin
|
||||
|
||||
// TODO: replace the dangling pointer with the next best value....
|
||||
// There is still a race condition, for another thread to access it...
|
||||
if (ctid <> 0) and not FCurrentProcess.GetThread(ctid, DummyThread) then
|
||||
FCurrentThread := nil;
|
||||
if (FCurrentThread <> nil) and not FCurrentProcess.GetThread(FCurrentThread.ID, DummyThread) then
|
||||
FreeAndNil(FCurrentThread);
|
||||
end;
|
||||
end;
|
||||
if not FCurrentProcess.WaitForDebugEvent(AProcessIdentifier, AThreadIdentifier) then
|
||||
|
@ -1029,8 +1029,6 @@ begin
|
||||
fpPTrace(PTRACE_KILL, AThread.ID, pointer(1), nil);
|
||||
TDbgLinuxThread(AThread).ResetPauseStates;
|
||||
Result := CheckNoError;
|
||||
if not FThreadMap.HasId(AThread.ID) then
|
||||
AThread.Free;
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -1127,8 +1125,6 @@ begin
|
||||
Result := CheckNoError;
|
||||
end;
|
||||
|
||||
if not FThreadMap.HasId(AThread.ID) then
|
||||
AThread.Free;
|
||||
{$IFDEF DebuglnLinuxDebugEvents}
|
||||
finally debuglnExit(['<<<<< TDbgLinuxProcess.Continue ' ]); end;
|
||||
{$ENDIF}
|
||||
|
@ -644,7 +644,6 @@ var
|
||||
begin
|
||||
debugln(['TDbgWinProcess.Continue ',SingleStep]);
|
||||
if assigned(AThread) and not FThreadMap.HasId(AThread.ID) then begin
|
||||
AThread.Free;
|
||||
AThread := nil;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user