1
0
Fork 0

Avoid double-invoke of Launcher Fly! button

If the user double-clicks, and their system is slow, the action can
fire twice, which then breaks because we add options twice.

Sentry-Id: FLIGHTGEAR-HKV
This commit is contained in:
Automatic Release Builder 2021-01-28 14:20:32 +00:00 committed by James Turner
parent d57bc67420
commit f1ab977ceb
2 changed files with 8 additions and 0 deletions

View file

@ -599,6 +599,13 @@ void LauncherController::setEnvironmentSummary(QStringList environmentSummary)
void LauncherController::fly()
{
// avoid duplicate calls to fly, if the user's system is slow, and they
// generate multiple clicks / events before the qApp->exit() fires.
// without this, we can apply options, etc twice which breaks.
if (m_flyRequested)
return;
m_flyRequested = true;
if (m_inAppMode) {
doApply();
m_keepRunningInAppMode = false;

View file

@ -326,6 +326,7 @@ private:
bool m_aircraftGridMode;
int m_launchCount = 0;
int m_versionLaunchCount = 0;
bool m_flyRequested = false;
};
#endif // LAUNCHERCONTROLLER_HXX