From 4c18c4f2a5fcdd267ca0fe49fbdd41dc8e60ec81 Mon Sep 17 00:00:00 2001 From: Henrique Gottardi Werlang Date: Wed, 22 Dec 2021 09:52:39 -0300 Subject: [PATCH] Adjusted the component insertion implementation, which did not remove the component from the original owner, only added in the other owner. --- packages/rtl/classes.pas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/rtl/classes.pas b/packages/rtl/classes.pas index 50a739e0..76e94b8b 100644 --- a/packages/rtl/classes.pas +++ b/packages/rtl/classes.pas @@ -5199,6 +5199,8 @@ procedure TComponent.InsertComponent(AComponent: TComponent); begin AComponent.ValidateContainer(Self); + if AComponent.FOwner <> nil then + AComponent.FOwner.RemoveComponent(AComponent); ValidateRename(AComponent,'',AComponent.FName); Insert(AComponent); If csDesigning in FComponentState then -- GitLab