Browse Source

Adjusted the component insertion implementation, which did not remove the component from the original owner, only added in the other owner.

Henrique Gottardi Werlang 3 years ago
parent
commit
4c18c4f2a5
1 changed files with 2 additions and 0 deletions
  1. 2 0
      packages/rtl/classes.pas

+ 2 - 0
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