Can modal callbacks be called syncrhonously?

When destroying my UI, there could be an AlertWindow still open, awaiting for the user to enter a name in it.

Said AlertWindow is in enterModalState() with a callback.

If I call ModalComponentManager::getInstance()->cancelAllModalComponents(); in the destructor of my UI, it defers the invocation of said callback with a triggerAsyncUpdate(), which unfortunately never gets a change of being served because the application is quitting.

Is there a way to have the callback invoked synchronously when exitModalState() is called?

I don’t think there’s a way to achieve this directly. Would it be viable to move the cancelAllModalComponents call somewhere else, such as systemRequestedQuit? Then, you could wait for all the modal windows to finish asynchronously, and quit the application (or not, if one of the modal windows aborted the quit!) after all the modal components have exited.

Thanks for the prompt response.

I forgot to mention it’s an audio plug-in, so unfortunately the systemRequestedQuit won’t work when loaded in a DAW.

I spoke about “application” because I’m debugging with the stand-alone and that came out instinctively, my bad.

Any other possibility?