Fixed a race condition that sometimes caused the main menus not to appear.

When Interface starts, it first calls pauseUntilLoginDetermined(), and later resumeAfterLoginDialogActionTaken().
But on rare occasions these functions are called in the reverse order, and this caused Interface to remain
in the "paused" state. Now we check for this case, and abort pauseUntilLoginDetermined() if it happens.

This has only happened to me when running Interface immediately after rebuilding it (in Release mode).
This commit is contained in:
Oren Hurvitz 2019-03-01 15:39:06 +02:00
parent 8e201f4801
commit 49165056c9
2 changed files with 12 additions and 0 deletions

View file

@ -5414,6 +5414,13 @@ void Application::pauseUntilLoginDetermined() {
return;
}
if (_resumeAfterLoginDialogActionTakenWasCalled) {
// This happens occasionally (though not often): resumeAfterLoginDialogActionTaken() has already been called.
// We must abort this method, otherwise Interface will remain in the "Paused" state permanently.
// E.g., the menus "Edit", "View", etc. will not appear.
return;
}
auto myAvatar = getMyAvatar();
_previousAvatarTargetScale = myAvatar->getTargetScale();
_previousAvatarSkeletonModel = myAvatar->getSkeletonModelURL().toString();
@ -5528,6 +5535,8 @@ void Application::resumeAfterLoginDialogActionTaken() {
menu->getMenu("Developer")->setVisible(_developerMenuVisible);
_myCamera.setMode(_previousCameraMode);
cameraModeChanged();
_resumeAfterLoginDialogActionTakenWasCalled = true;
}
void Application::loadAvatarScripts(const QVector<QString>& urls) {

View file

@ -802,5 +802,8 @@ private:
bool _showTrackedObjects { false };
bool _prevShowTrackedObjects { false };
// Whether resumeAfterLoginDialogActionTaken() has been called
bool _resumeAfterLoginDialogActionTakenWasCalled { false };
};
#endif // hifi_Application_h