Menu designer: Prevent AV, if Menu designer is opened and more then one TPopupMenu are edited and selected in Object inspector.

git-svn-id: trunk@53851 -
This commit is contained in:
michl 2017-01-03 09:48:20 +00:00
parent ffc1493b4a
commit b8e6ac48a0
3 changed files with 6 additions and 10 deletions

View File

@ -241,20 +241,13 @@ end;
destructor TMenuDesignerBase.Destroy;
begin
if (FShadowMenu <> nil) then begin
FShadowMenu.Parent:=nil;
FreeAndNil(FShadowMenu);
end;
FreeShadowMenu;
FreeAndNil(FShortcuts);
inherited Destroy;
end;
procedure TMenuDesignerBase.FreeShadowMenu;
begin
if FShadowMenu <> nil then
FShadowMenu.SelectedMenuItem:=nil;
if Assigned(GlobalDesignHook) then
GlobalDesignHook.RemoveAllHandlersForObject(FShadowMenu);
FreeAndNil(FShadowMenu);
end;

View File

@ -1894,6 +1894,10 @@ end;
destructor TShadowMenu.Destroy;
begin
Parent := nil;
GlobalDesignHook.RemoveHandlerRefreshPropertyValues(@OnDesignerRefreshPropertyValues);
GlobalDesignHook.RemoveHandlerModified(@OnDesignerModified);
GlobalDesignHook.RemoveHandlerObjectPropertyChanged(@OnObjectPropertyChanged);
inherited Destroy;
end;

View File

@ -568,8 +568,7 @@ begin
end
else if (aMenu <> FEditedMenu) then
begin
FDesigner.ShadowMenu.Free;
FDesigner.ShadowMenu := Nil;
FDesigner.FreeShadowMenu;
FEditedMenu := aMenu;
selection := aMenuItem;
end;