Hello,
in a MessageData
plugin, I'm listening to a specific core message (sent from another part of my plugin). When processing that message in MessageData::CoreMessage()
, I need to open a modal dialog (GeModalDialog
) to get user credentials.
Everything works perfectly. However, when that dialog opens, I get this message in the debugger:
You MUST NOT NEVER EVER use a modal dialog in a timer. Please run a job on the main thread (see job.h).
Even though everything behaves as expected, I decided to take the advice and open the dialog on the main thread. This is how I'm doing it:
Bool GetUserCredentials(String &username, String &password)
{
// CredentialsDialog is a GeModalDialog derivative
CredentialsDialog credentialsDialog;
credentialsDialog.Open();
if (credentialsDialog.GetResult())
{
credentialsDialog.GetCredentials(username, password);
return true;
}
return false;
}
...
// Ask the user for credentials, so we can acquire a new access token
String username, password;
auto getUserCredentials = [&username, &password] () -> Bool
{
// Open the dialog and get the credentials the user has typed in
return GetUserCredentials(username, password);
};
if (maxon::ExecuteOnMainThread(getUserCredentials, true))
{
// Do something useful
// ...
Well, it still works as expected, but I am also still getting that message in the debugger. What could be wrong?
Thanks for any hints & advice!
Cheers,
Frank