FpDebug: Refactor freeing thread objects for exited threads

git-svn-id: trunk@62175 -
This commit is contained in:
martin 2019-11-03 17:05:40 +00:00
parent 751d6dd60d
commit 17dda63638
3 changed files with 2 additions and 11 deletions

View File

@ -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

View File

@ -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}

View File

@ -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;