Skip to content

Commit

Permalink
Fixed potential bug in destruction order. #20
Browse files Browse the repository at this point in the history
  • Loading branch information
bero committed Dec 7, 2024
1 parent 5a4b442 commit 80424c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Source/BoldElements.pas
Original file line number Diff line number Diff line change
Expand Up @@ -974,11 +974,16 @@ constructor TBoldExternalVariable.Create(AEvaluator: TBoldEvaluator; const AName
end;

destructor TBoldExternalVariable.Destroy;
var
vEvaluator: TBoldEvaluator;
begin
fSubscriber.Free;
if Assigned(fEvaluator) then
fEvaluator.UndefineVariable(self);
fEvaluator := nil;
vEvaluator := fEvaluator;
if Assigned(vEvaluator) then
begin
fEvaluator := nil;
vEvaluator.UndefineVariable(self);
end;
inherited;
end;

Expand Down

0 comments on commit 80424c8

Please sign in to comment.