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.