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

View File

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