JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.
Add a following line to the DemoTaskbarComponent constructor to avoid uninitialised main menu assertion failure:
juce::MenuBarModel::setMacMainMenu (&menu_model, nullptr);
Replace m.showMenuAsync() call in DemoTaskbarComponent::timerCallback() method with:
#if JUCE_MAC
showDropdownMenu(m);
#endif
Press the top bar icon a few times (the Quit menu should appear at least twice)
Call "leaks DemoRunner" in the terminal, NSMenu object(s) leak detected.
Adding [m release]; to void showMenu (const PopupMenu& menu) method solves the issue (juce_SystemTrayIcon_mac.cpp).
void showMenu (const PopupMenu& menu)
{
if (NSMenu* m = createNSMenu (menu, "MenuBarItem", -2, -3, true))
{
setHighlighted (true);
stopTimer();
// There's currently no good alternative to this.
[statusItem.get() popUpStatusItemMenu: m];
startTimer (1);
[m release];
}
}
Detailed steps on how to reproduce the bug
A problem could be reproduced on a modified DemoRunner example (modified Main.cpp -> Main.txt attached).
Add a following line to the DemoTaskbarComponent constructor to avoid uninitialised main menu assertion failure:
juce::MenuBarModel::setMacMainMenu (&menu_model, nullptr);
Replace m.showMenuAsync() call in DemoTaskbarComponent::timerCallback() method with:
Press the top bar icon a few times (the Quit menu should appear at least twice)
Call "leaks DemoRunner" in the terminal, NSMenu object(s) leak detected.
Adding [m release]; to void showMenu (const PopupMenu& menu) method solves the issue (juce_SystemTrayIcon_mac.cpp).
Main.txt
leaks_DemoRunner.txt
DemoRunner.zip
What is the expected behaviour?
NSMenu is not leaking
Operating systems
macOS
What versions of the operating systems?
Any, but tested on 14.4
Architectures
ARM
Stacktrace
No response
Plug-in formats (if applicable)
Standalone
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the
develop
branchI have not tested against the
develop
branchCode of Conduct