How can I show a blocking alert window in a non-message thread? In essence, I have a worker thread, and in case there’s an unexpected error, I need to ask the user how to continue after the error, which means the message box must block the worker thread. Before, in Juce 6.0.8, I just did:
const auto result = AlertWindow::showYesNoCancelBox(AlertWindow::AlertIconType::QuestionIcon, "Continue?",
question,
"Retry",
"Force pass",
"Fail"
);
and that did the trick. Now, in Juce 7.0.6, I get an assert that the message manager should be locked. So now I write:
MessageManagerLock managerLock{};
const auto result = AlertWindow::showYesNoCancelBox(AlertWindow::AlertIconType::QuestionIcon, "Continue?",
question,
"Retry",
"Force pass",
"Fail"
);
However, this triggers an assert from Component::removeFromDesktop(), jassert (peer != nullptr); (at juce_Component.cpp::437).
I suppose I could use the callback version and implement an explicit wait, but then I’ll be reimplementing what the one-liner did early on itself. Is there an easier way?
