I’m using a PopupMenu in my AU plugin. If I open the PopupMenu and close the GUI window for the plugin, the PopupMenu stays - and when clicking inside it, it causes the AU Host to crash. I tested this with Logic 7.2
I notice some host do not allow to close the application/window before the PopupMenu is clicked - but Logic is one of the hosts that does allow this.
Slightly tricky - if you call showMenu() in a method call of a component, and that component gets deleted before showMenu() returns, then anything you do afterwards might be using a dangling pointer. Try using a ComponentDeletionWatcher to double-check the state of your component after the showmenu() method, and if it’s been deleted, do a return pretty sharpish.
TBH I don’t think there’s actually any other way of avoiding the problem…
I guess it’s dangling because there’s no way juce can get any hint from logic that the focus has changed. I’ll have a look and see what I can do. Probably a useful addition would be a dismissAllMenus() type function that you could call if your UI is deleted. I’ll throw that into the build soon.
I tried it and it works. There is one problem however, in the AudioUnitWrapper you have this:
void deleteUI()
{
// there's some kind of component currently modal, but the host
// is trying to delete our plugin..
jassert (Component::getCurrentlyModalComponent() == 0);
I call the PopupMenu::dismissAllActiveMenus() in my UI class destructor, but this assert will fail since the menu is still modal.
Ok, looks to me like the deletUI method is actually the place that dismissAllActiveMenus() should get called, just before the assertion. I’ve made that change now, and also done it in the vst and rtas wrappers.