Modal component (Label texteditor) triggering jassert when closing AU window


Hey everyone,

Just wanted to see if I could shed some light on the best way to address an issue that I don't fully understand in my audio unit plugin. I'm currently working on developing a parameter management system for a plugin I'd like to make a bit further down the line, and I'm prototyping this system with a really simple gain/pan plugin. I noticed some strange behavior that I can't quite wrap my head around:

I have an editable Label that, when focused and acting as a TextEditor, seems to trigger a jassert ("there's some kind of component currently modal, but the host  is trying to delete our plugin..") in when I try to close the Audio Unit plugin in my host (Logic).

I'm trying to figure out the best way to handle this. Currently I'm adding the following before the jassert:

if (Component::getCurrentlyModalComponent())

jassert (Component::getCurrentlyModalComponent() == nullptr);

This gets rid of the modal state of the Label Texteditor in the shutdown function in the JuceUIViewClass struct of  juce_wrapper_au, but I REALLY don't understand exactly what's happening in the AU wrapper and I'm loathe to mess with it anymore - I'd really like to do this kind of "cleanup" work in the actual plugin code, but adding this code to either the AudioProcessor or AudioProcessorEditor destructors doesn't solve the problem.

Any ideas?


Are you leaking your components?

If your editor correctly deletes all its children then a Label/TextEditor can't still be modal after it has been deleted! And the editor itself will certainly be deleted before the plugin gets shut down.


I'm definitely not leaking any components, unless I'm missing something unbelievably obvious (which, I admit, is a possibility!)

So what I'm seeing is that the shutdown function in the JuceUIViewClass struct of  is getting called before the destructor of the Label. In fact, it's getting called before the destructor of the AudioProcessorEditor.

Not sure how to address this other than change the juce_AU_wrapper code, since it's automatically trying to catch any modal components before actually calling deleteEditor.


Ok - actually, looking a bit more deeply, this is a non-issue.

It's actually fine for a component to be modal as long as it's not running inside an actual modal loop, and the Label class won't do that. The assertion is a false alarm in this case, so I'll tidy that up.