* Removing from previous owner after doing validation

This commit is contained in:
Michaël Van Canneyt 2022-01-13 22:43:44 +01:00
parent 49b0ae4bec
commit 0d7474cec4

View File

@ -5199,9 +5199,9 @@ procedure TComponent.InsertComponent(AComponent: TComponent);
begin
AComponent.ValidateContainer(Self);
ValidateRename(AComponent,'',AComponent.FName);
if AComponent.FOwner <> nil then
AComponent.FOwner.RemoveComponent(AComponent);
ValidateRename(AComponent,'',AComponent.FName);
Insert(AComponent);
If csDesigning in FComponentState then
AComponent.SetDesigning(true);