LazDebuggerFpGdbmi: fixed a crash in watches eval, after cancel of watch eval due to dbg error.

git-svn-id: trunk@61056 -
This commit is contained in:
martin 2019-04-25 17:43:00 +00:00
parent aea75fde5e
commit 142b226591

View File

@ -94,6 +94,7 @@ type
property CurrentCommand;
property TargetPID;
protected
procedure ClearWatchEvalList;
procedure DoWatchFreed(Sender: TObject);
function EvaluateExpression(AWatchValue: TWatchValue;
AExpression: String;
@ -347,7 +348,7 @@ end;
procedure TFpGDBMIDebuggerCommandEvaluate.DoCancel;
begin
FOwner.FpDebugger.FWatchEvalList.Clear;
FOwner.FpDebugger.ClearWatchEvalList;
FOwner.FEvaluationCmdObj := nil;
inherited DoCancel;
end;
@ -735,13 +736,8 @@ begin
if OldState in [dsPause, dsInternalPause] then begin
for i := 0 to MAX_CTX_CACHE-1 do
ReleaseRefAndNil(FLastContext[i]);
if not(State in [dsPause, dsInternalPause]) then begin
for i := 0 to FWatchEvalList.Count - 1 do begin
TWatchValue(FWatchEvalList[i]).RemoveFreeNotification(@DoWatchFreed);
//TWatchValueBase(FWatchEvalList[i]).Validity := ddsInvalid;
end;
FWatchEvalList.Clear;
end;
if not(State in [dsPause, dsInternalPause]) then
ClearWatchEvalList;
end;
end;
@ -950,6 +946,17 @@ begin
// TODO Result.AddReference;
end;
procedure TFpGDBMIDebugger.ClearWatchEvalList;
var
i: Integer;
begin
for i := 0 to FWatchEvalList.Count - 1 do begin
TWatchValue(FWatchEvalList[i]).RemoveFreeNotification(@DoWatchFreed);
//TWatchValueBase(FWatchEvalList[i]).Validity := ddsInvalid;
end;
FWatchEvalList.Clear;
end;
type
TGDBMIDwarfTypeIdentifier = class(TFpDwarfSymbolType)
public
@ -1164,6 +1171,7 @@ destructor TFpGDBMIDebugger.Destroy;
begin
CurrentDebugger := nil;
UnLoadDwarf;
ClearWatchEvalList;
FWatchEvalList.Free;
inherited Destroy;
end;