LazDebuggerFp: improve error handling

This commit is contained in:
Martin 2022-08-31 02:48:13 +02:00
parent c8d378a70d
commit 552fd1dce8
2 changed files with 34 additions and 23 deletions

View File

@ -1032,13 +1032,15 @@ end;
procedure TFpThreadWorkerWatchValueEvalUpdate.UpdateWatch_DecRef(Data: PtrInt);
var
dbg: TFpDebugDebuggerBase;
w: TWatchValueIntf;
begin
assert(system.ThreadID = classes.MainThreadID, 'TFpThreadWorkerWatchValueEval.UpdateWatch_DecRef: system.ThreadID = classes.MainThreadID');
if FWatchValue <> nil then begin
FWatchValue.RemoveNotification(weeCancel, @DoWachCanceled);
FWatchValue.EndUpdate;
w := FWatchValue;
FWatchValue := nil;
w.RemoveNotification(weeCancel, @DoWachCanceled);
w.EndUpdate;
end;
dbg := FDebugger;
@ -1047,13 +1049,16 @@ begin
end;
procedure TFpThreadWorkerWatchValueEvalUpdate.DoRemovedFromLinkedList;
var
w: TWatchValueIntf;
begin
if FWatchValue <> nil then begin
FWatchValue.RemoveNotification(weeCancel, @DoWachCanceled);
if FWatchValue.Validity = ddsRequested then
FWatchValue.Validity := ddsInvalid;
FWatchValue.EndUpdate;
FWatchValue := nil;
w := FWatchValue;
w.RemoveNotification(weeCancel, @DoWachCanceled);
if w.Validity = ddsRequested then
w.Validity := ddsInvalid;
w.EndUpdate;
end;
UnQueue_DecRef;
end;

View File

@ -423,14 +423,17 @@ begin
exit;
FLocked := True;
WorkItem := FNextWorker;
try
while (WorkItem <> nil) and (WorkItem.RefCount = 1) do begin
w := WorkItem;
WorkItem := w.FNextWorker;
w.DoRemovedFromLinkedList;
w.DecRef;
end;
finally
FNextWorker := WorkItem;
FLocked := False;
end;
end;
procedure TFpDbgDebggerThreadWorkerLinkedList.RequestStopForWorkers;
@ -456,6 +459,7 @@ begin
FLocked := True;
WorkItem := FNextWorker;
FNextWorker := nil;
try
while (WorkItem <> nil) do begin
w := WorkItem;
WorkItem := w.FNextWorker;
@ -466,7 +470,9 @@ begin
w.DoRemovedFromLinkedList;
w.DecRef;
end;
finally
FLocked := False;
end;
end;
{ TFpThreadWorkerControllerRun }