From 0d545c68de8fc93e533505946628662bb4ddc500 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 22 Mar 2012 14:49:43 +0000 Subject: [PATCH] * Call getOwner only once in several TPersistent methods (Patch from Luiz Americo, bug #21531) git-svn-id: trunk@20574 - --- rtl/objpas/classes/persist.inc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rtl/objpas/classes/persist.inc b/rtl/objpas/classes/persist.inc index 66546c560a..50fdc96ba7 100644 --- a/rtl/objpas/classes/persist.inc +++ b/rtl/objpas/classes/persist.inc @@ -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;