From 701cc16d1262d0912ff497afaf00054216f7ac57 Mon Sep 17 00:00:00 2001 From: Henrique Gottardi Werlang Date: Mon, 22 May 2023 17:48:33 -0300 Subject: [PATCH] Changed the loading behavior of TComponent derived classes. --- packages/rtl/classes.pas | 101 ++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/packages/rtl/classes.pas b/packages/rtl/classes.pas index 3408a04..012e4d8 100644 --- a/packages/rtl/classes.pas +++ b/packages/rtl/classes.pas @@ -9931,61 +9931,64 @@ begin end; end; -function InitInheritedComponent(Instance: TComponent; RootAncestor: TClass): Boolean; -Var - I : Integer; +function FindInitComponentHandler(const ComponentClass: TComponentClass; var Handler: TInitHandler): Boolean; +var + A: Integer; + begin - I:=0; - if not Assigned(InitHandlerList) then begin - Result := True; - Exit; + Result := False; + + if not Assigned(InitHandlerList) then + InitHandlerList := TList.Create; + + for A := 0 to Pred(InitHandlerList.Count) do + begin + Handler := TInitHandler(InitHandlerList.Items[A]); + + if Handler.AClass = ComponentClass then + Exit(True); end; - Result:=False; - With InitHandlerList do - begin - I:=0; - // Instance is the normally the lowest one, so that one should be used when searching. - While Not result and (I