Преглед на файлове

* Remove component from previous owner. Fix issue #39529

Michaël Van Canneyt преди 3 години
родител
ревизия
d6a26f2c28
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      rtl/objpas/classes/compon.inc

+ 2 - 0
rtl/objpas/classes/compon.inc

@@ -603,6 +603,8 @@ Procedure TComponent.InsertComponent(AComponent: TComponent);
 begin
   AComponent.ValidateContainer(Self);
   ValidateRename(AComponent,'',AComponent.FName);
+  If AComponent.FOwner<>Nil then
+    AComponent.FOwner.Remove(AComponent);
   Insert(AComponent);
   AComponent.SetReference(True);
   If csDesigning in FComponentState then