cocoa: menus - fix cocoa app mem leak for allocated TcocoaMenuItems

git-svn-id: trunk@59754 -
This commit is contained in:
dmitry 2018-12-07 04:04:18 +00:00
parent 480574f3d9
commit 360bfc74b1

View File

@ -588,10 +588,12 @@ begin
if Assigned(menuitem.menu) then
menuitem.menu.removeItem(menuitem);
AMenuItem.Handle := 0;
menuitem.release; // TCocoaMenuItems are "alloced" - thus should be released;
end else if item.isKindOfClass_(NSMenuItem) then begin
nsitem := NSMenuItem(item);
if nsitem.isSeparatorItem and Assigned(nsitem.menu) then
nsitem.menu.removeItem(nsitem);
// separator items are not "alloced", thus should not be released
end;
end;