IDE: menu designer: replaced some free with releasecomponent, controls may be still processing events, bug #31791

git-svn-id: trunk@54849 -
This commit is contained in:
mattias 2017-05-10 13:02:11 +00:00
parent 00e50506fa
commit 2b183faa9b

View File

@ -632,16 +632,17 @@ end;
procedure TShadowMenu.AddOnClick(Sender: TObject); procedure TShadowMenu.AddOnClick(Sender: TObject);
var var
compEditor: TDefaultComponentEditor; CompEditor: TDefaultComponentEditor;
begin begin
if (FSelectedMenuItem <> nil) then begin if (FSelectedMenuItem <> nil) then begin
FDesigner.FGui.BeginUpdate; FDesigner.FGui.BeginUpdate;
CompEditor:=nil;
try try
compEditor:=TDefaultComponentEditor.Create(FSelectedMenuItem, FEditorDesigner); CompEditor:=TDefaultComponentEditor.Create(FSelectedMenuItem, FEditorDesigner);
compEditor.Edit; CompEditor.Edit;
UpdateSelectedItemInfo; UpdateSelectedItemInfo;
finally finally
compEditor.Free; CompEditor.Free;
FDesigner.FGui.EndUpdate; FDesigner.FGui.EndUpdate;
end; end;
end; end;
@ -887,7 +888,7 @@ begin
box.ShadowList.Remove(anExistingSI); box.ShadowList.Remove(anExistingSI);
anExistingSI.Parent:=nil; anExistingSI.Parent:=nil;
box.RemoveComponent(anExistingSI); box.RemoveComponent(anExistingSI);
FreeAndNil(anExistingSI); Application.ReleaseComponent(anExistingSI);
FEditorDesigner.PropertyEditorHook.DeletePersistent(TPersistent(mi)); FEditorDesigner.PropertyEditorHook.DeletePersistent(TPersistent(mi));
FEditorDesigner.PropertyEditorHook.Modified(mi); FEditorDesigner.PropertyEditorHook.Modified(mi);
FreeAndNil(mi); FreeAndNil(mi);
@ -900,7 +901,7 @@ begin
RemoveComponent(box); RemoveComponent(box);
if box=FRootBox then if box=FRootBox then
FRootBox:=nil; FRootBox:=nil;
FreeAndNil(box); Application.ReleaseComponent(box);
end; end;
UpdateBoxLocationsAndSizes; UpdateBoxLocationsAndSizes;
SetSelectedMenuItem(nearestMI, False, True); SetSelectedMenuItem(nearestMI, False, True);
@ -931,7 +932,7 @@ begin
si:=GetShadowForMenuItem(sb.ParentMenuItem); si:=GetShadowForMenuItem(sb.ParentMenuItem);
if Assigned(si) then if Assigned(si) then
si.Invalidate; si.Invalidate;
FreeAndNil(sb); Application.ReleaseComponent(sb);
end; end;
end; end;
@ -1329,7 +1330,7 @@ begin
FBoxList.Remove(aSB); FBoxList.Remove(aSB);
aSB.Parent:=nil; aSB.Parent:=nil;
RemoveComponent(aSB); RemoveComponent(aSB);
FreeAndNil(aSB); Application.ReleaseComponent(aSB);
UpdateBoxLocationsAndSizes; UpdateBoxLocationsAndSizes;
SetSelectedMenuItem(miToSelect, False, True); SetSelectedMenuItem(miToSelect, False, True);
end; end;