* Remove component from previous owner. Fix issue #39529

This commit is contained in:
Michaël Van Canneyt 2022-01-13 22:41:01 +01:00
parent 42361be239
commit d6a26f2c28

View File

@ -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