Browse Source

* Properly pass on FUsePublishedOnly to properties. Fixes issue #40702

Michaël Van Canneyt 1 year ago
parent
commit
e7184f3126
1 changed files with 6 additions and 3 deletions
  1. 6 3
      packages/rtl-objpas/src/inc/rtti.pp

+ 6 - 3
packages/rtl-objpas/src/inc/rtti.pp

@@ -5957,8 +5957,10 @@ begin
             FProperties[TP^.NameIndex] := obj as TRttiProperty
           else
             begin
-            FProperties[TP^.NameIndex] := TRttiProperty.Create(TypeRttiType, TP);
-            GRttiPool[FUsePublishedOnly].AddObject(FProperties[TP^.NameIndex]);
+            Obj:=TRttiProperty.Create(TypeRttiType, TP);
+            Obj.FUsePublishedOnly:=Self.FUsePublishedOnly;
+            FProperties[TP^.NameIndex] := TRttiProperty(Obj);
+            GRttiPool[FUsePublishedOnly].AddObject(Obj);
             end;
           end;
         // Point to TP next propinfo record.
@@ -5967,7 +5969,8 @@ begin
         Dec(Count);
       end;
     lTypeInfo:=TD^.Parentinfo;
-    TypeRttiType:= GRttiPool[FUsePublishedOnly].GetType(lTypeInfo);
+    if lTypeInfo<>Nil then
+      TypeRttiType:= GRttiPool[FUsePublishedOnly].GetType(lTypeInfo);
   until lTypeInfo=nil;
   FPropertiesResolved:=True;
 end;