Defer launch warnings until after launch validation

We need to destroy the SDL window before we can be sure that Qt
can draw to the screen if we used KMSDRM.
This commit is contained in:
Cameron Gutman 2024-09-23 21:48:43 -05:00
parent 0e2d5bf441
commit 6d023c2dfa
2 changed files with 25 additions and 16 deletions

View File

@ -902,11 +902,10 @@ bool Session::initialize()
return false;
}
return true;
}
void Session::emitLaunchWarning(QString text)
{
// Display launch warnings in Qt only after destroying SDL's window.
// This avoids conflicts between the windows on display subsystems
// such as KMSDRM that only support a single window.
for (const auto &text : m_LaunchWarnings) {
// Emit the warning to the UI
emit displayLaunchWarning(text);
@ -923,6 +922,15 @@ void Session::emitLaunchWarning(QString text)
QCoreApplication::sendPostedEvents();
}
}
}
return true;
}
void Session::emitLaunchWarning(QString text)
{
// Queue this launch warning to be displayed after validation
m_LaunchWarnings.append(text);
}
bool Session::validateLaunch(SDL_Window* testWindow)

View File

@ -260,6 +260,7 @@ private:
SdlInputHandler* m_InputHandler;
int m_MouseEmulationRefCount;
int m_FlushingWindowEventsRef;
QList<QString> m_LaunchWarnings;
bool m_AsyncConnectionSuccess;
int m_PortTestResults;