PopupMenu crashes the software

The following code crashes when popup menu is visible and I exit the software in OSX. How to use PopupMenus so they don’t crash?

void MyClass::mouseDown(const MouseEvent& e)
PopupMenu pop_up_menu;
pop_up_menu.addItem (1, “item 1”);
pop_up_menu.addItem (2, “item 2”);

const int result = pop_up_menu.show();


Rather than using the modal show function, try using showMenuAsync.

Seems to work. I did the following without crashes:

PopupMenu popup_menu;
popup_menu.addItem("Add row", []() { });
popup_menu.addItem("Delete row", []() { });
popup_menu.addItem("Add column", []() { });
popup_menu.addItem("Delete column", []() { });

Just in case I added this into application’s systemRequestQuit():

Is that dismissAllActiveMenus() good to have there or is it not needed?