* extract a symbol or def from its previous owner if that owner has OwnsObjects set to true

This commit is contained in:
Sven/Sarah Barth 2022-01-17 22:17:57 +01:00
parent 088c746d45
commit a7a0f47d98

View File

@ -510,8 +510,8 @@ implementation
procedure tdef.ChangeOwner(st:TSymtable);
begin
// if assigned(Owner) then
// Owner.DefList.List[i]:=nil;
if assigned(Owner) and owner.deflist.OwnsObjects then
Owner.DefList.extract(self);
Owner:=st;
Owner.DefList.Add(self);
end;
@ -680,6 +680,8 @@ implementation
procedure tsym.ChangeOwner(st:TSymtable);
begin
if assigned(owner) and owner.SymList.OwnsObjects then
owner.symlist.extract(self);
Owner:=st;
inherited ChangeOwner(Owner.SymList);
end;