Browse Source

* Patch from Mattias Gaertner to fix property overrides. (bug ID 14885)

git-svn-id: trunk@13939 -
michael 16 years ago
parent
commit
89ec956733
1 changed files with 7 additions and 4 deletions
  1. 7 4
      rtl/objpas/classes/writer.inc

+ 7 - 4
rtl/objpas/classes/writer.inc

@@ -1040,11 +1040,14 @@ begin
              (ObjValue is TComponent) then
              (ObjValue is TComponent) then
           begin
           begin
             //writeln('TWriter.WriteProperty AncestorObj=',TComponent(AncestorObj).Name,' OwnerFit=',TComponent(AncestorObj).Owner = FRootAncestor,' ',TComponent(ObjValue).Name,' OwnerFit=',TComponent(ObjValue).Owner = Root);
             //writeln('TWriter.WriteProperty AncestorObj=',TComponent(AncestorObj).Name,' OwnerFit=',TComponent(AncestorObj).Owner = FRootAncestor,' ',TComponent(ObjValue).Name,' OwnerFit=',TComponent(ObjValue).Owner = Root);
-            if (TComponent(AncestorObj).Owner <> FRootAncestor) or
-             (TComponent(ObjValue).Owner <> Root) or
-             (UpperCase(TComponent(AncestorObj).Name) <> UpperCase(TComponent(ObjValue).Name)) then
+            if (AncestorObj<> ObjValue) and
+             (TComponent(AncestorObj).Owner = FRootAncestor) and
+             (TComponent(ObjValue).Owner = Root) and
+             (UpperCase(TComponent(AncestorObj).Name) = UpperCase(TComponent(ObjValue).Name)) then
             begin
             begin
-              AncestorObj := nil;
+              // different components, but with the same name
+              // treat it like an override
+              AncestorObj := ObjValue;
             end;
             end;
           end;
           end;
         end else
         end else