* Call getOwner only once in several TPersistent methods (Patch from Luiz Americo, bug #21531)

git-svn-id: trunk@20574 -
This commit is contained in:
michael 2012-03-22 14:49:43 +00:00
parent 1bf8ef2428
commit 0d545c68de

View File

@ -61,12 +61,14 @@ end;
function TPersistent.GetNamePath: string;
Var OwnerName :String;
TheOwner: TPersistent;
begin
Result:=ClassNAme;
If GetOwner<>Nil then
Result:=ClassName;
TheOwner:=GetOwner;
If TheOwner<>Nil then
begin
OwnerName:=GetOwner.GetNamePath;
OwnerName:=TheOwner.GetNamePath;
If OwnerName<>'' then Result:=OwnerName+'.'+Result;
end;
end;
@ -77,10 +79,14 @@ end;
{****************************************************************************}
procedure TInterfacedPersistent.AfterConstruction;
Var TheOwner: TPersistent;
begin
inherited;
if assigned(GetOwner) then
GetOwner.GetInterface(IUnknown,FOwnerInterface);
TheOwner:=GetOwner;
if assigned(TheOwner) then
TheOwner.GetInterface(IUnknown,FOwnerInterface);
end;