mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 18:39:28 +02:00
cocoa: update removal of menuItems. Removing an item from parent menu rather than from parentItem's menu. #34602
git-svn-id: trunk@59752 -
This commit is contained in:
parent
8a1e0ddf12
commit
eb70a1aff6
@ -569,29 +569,28 @@ class procedure TCocoaWSMenuItem.DestroyHandle(const AMenuItem: TMenuItem);
|
||||
var
|
||||
callback: IMenuItemCallback;
|
||||
callbackObject: TObject;
|
||||
item : NSObject;
|
||||
parItem : NSObject;
|
||||
item : NSObject;
|
||||
menuitem : TCocoaMenuItem;
|
||||
begin
|
||||
if AMenuItem.Caption <> '-' then
|
||||
begin
|
||||
begin
|
||||
item:=NSObject(AMenuItem.Handle);
|
||||
if item.isKindOfClass_(TCocoaMenuItem) then
|
||||
begin
|
||||
callback := TCocoaMenuItem(item).lclGetCallback;
|
||||
begin
|
||||
menuitem := TCocoaMenuItem(item);
|
||||
callback := menuitem.lclGetCallback;
|
||||
if Assigned(callback) then
|
||||
begin
|
||||
begin
|
||||
callbackObject := callback.GetCallbackObject;
|
||||
callback := nil;
|
||||
TCocoaMenuItem(item).lclClearCallback;
|
||||
menuitem.lclClearCallback;
|
||||
callbackObject.Free;
|
||||
end;
|
||||
parItem := TCocoaMenuItem(Item).parentItem;
|
||||
if assigned(parItem) and parItem.isKindOfClass_(NSMenuItem) then
|
||||
NSMenuItem(paritem).submenu.removeItem(NSMenuItem(item));
|
||||
//Item.Release;
|
||||
end;
|
||||
if Assigned(menuitem.menu) then
|
||||
menuitem.menu.removeItem(menuitem);
|
||||
AMenuItem.Handle := 0;
|
||||
end
|
||||
end;
|
||||
end
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user