I tried calling DialogWindow::showModalDialog from another thread than the message thread on Mac OS X and I hit the
CHECK_MESSAGE_MANAGER_IS_LOCKED assert in Component::addToDesktop.
I have hit this assert before, so I add a MessageManagerLock before calling showModalDialog.
Now I hit the assert
jassert(! currentThreadHasLockedMessageManager()) in MessageManager::callFunctionOnMessageThread which is called from Component::runModalLoop.
These two asserts contradict each other, meaning that showModalDialog cannot be called from any other thread than the message thread, even though Component::runModalLoop tries to run it on the messsage thread.
On Windows I hit an assert when setting the title for the window, saying that only the message thread can call this function.
I am unsure whether this issue needs to be fixed or whether an assert checking that the current thread is the message thread just needs to be added to DialogWindow::showModalDialog.
My own work around for this issue is to create a DialogWindow with DialogWindow::LaunchOptions::launchAsync() inside a callFunctionOnMessageThread callback and then just call runModalLoop on this window. Example code below.
[code]DialogWindow* window = static_cast<DialogWindow*>( MessageManager::getInstance()->callFunctionOnMessageThread(&CreateDialogWindow, &options) );
I could be that this is just the proper way to handle this case or maybe this is an issue which needs to be fixed.