소스 검색

* 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
 begin
   AComponent.ValidateContainer(Self);
   AComponent.ValidateContainer(Self);
   ValidateRename(AComponent,'',AComponent.FName);
   ValidateRename(AComponent,'',AComponent.FName);
+  If AComponent.FOwner<>Nil then
+    AComponent.FOwner.Remove(AComponent);
   Insert(AComponent);
   Insert(AComponent);
   AComponent.SetReference(True);
   AComponent.SetReference(True);
   If csDesigning in FComponentState then
   If csDesigning in FComponentState then