LazDebuggerFpLLDB: Fix potential dangling pointer in Locals eval.

git-svn-id: trunk@59802 -
This commit is contained in:
martin 2018-12-12 13:46:01 +00:00
parent 5c4bd12dd3
commit 9de85d233b

View File

@ -189,6 +189,7 @@ type
private private
FOwner: TFPLldbLocals; FOwner: TFPLldbLocals;
FLocals: TLocals; FLocals: TLocals;
procedure DoLocalsFreed(Sender: TObject);
protected protected
procedure DoExecute; override; procedure DoExecute; override;
public public
@ -260,9 +261,17 @@ type
{ TFpLldbDebuggerCommandLocals } { TFpLldbDebuggerCommandLocals }
procedure TFpLldbDebuggerCommandLocals.DoLocalsFreed(Sender: TObject);
begin
FLocals := nil;
end;
procedure TFpLldbDebuggerCommandLocals.DoExecute; procedure TFpLldbDebuggerCommandLocals.DoExecute;
begin begin
FOwner.ProcessLocals(FLocals); if FLocals <> nil then begin
FOwner.ProcessLocals(FLocals);
FLocals.RemoveFreeNotification(@DoLocalsFreed);
end;
Finished; Finished;
end; end;
@ -271,6 +280,7 @@ begin
inherited Create(AOwner.FpDebugger); inherited Create(AOwner.FpDebugger);
FOwner := AOwner; FOwner := AOwner;
FLocals := ALocals; FLocals := ALocals;
FLocals.AddFreeNotification(@DoLocalsFreed);
////// Priority := 1; // before watches ////// Priority := 1; // before watches
end; end;