mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 01:14:17 +02:00
Fixed a race condition related to the keyboard when starting Interface.
These two things need to happen in the following order: 1. Initialize the input plugins (including the keyboard) 2. Start the scripts That's because the scripts try to use the keyboard (e.g., in edit.js), and if it's not ready yet then they fail, and then Interface doesn't work right (e.g., the Create button doesn't work). In order to ensure that these things happen in the correct order, we must make sure that resumeAfterLoginDialogActionTaken() (which starts the scripts) is called only after everything else in the Interface constructor has finished. Usually this happens correctly, but occasionally resumeAfterLoginDialogActionTaken() is called too soon. This commit makes sure that even in that case, we'll postpone calling resumeAfterLoginDialogActionTaken() until the Interface constructor has finished.
This commit is contained in:
parent
49165056c9
commit
7a8b7c095b
2 changed files with 15 additions and 12 deletions
|
@ -5414,13 +5414,6 @@ 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();
|
||||
|
@ -5459,6 +5452,13 @@ void Application::pauseUntilLoginDetermined() {
|
|||
// disconnect domain handler.
|
||||
nodeList->getDomainHandler().disconnect();
|
||||
|
||||
// From now on, it's permissible to call resumeAfterLoginDialogActionTaken()
|
||||
_resumeAfterLoginDialogActionTaken_SafeToRun = true;
|
||||
|
||||
if (_resumeAfterLoginDialogActionTaken_WasPostponed) {
|
||||
// resumeAfterLoginDialogActionTaken() was already called, but it aborted. Now it's safe to call it again.
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::resumeAfterLoginDialogActionTaken() {
|
||||
|
@ -5467,6 +5467,11 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_resumeAfterLoginDialogActionTaken_SafeToRun) {
|
||||
_resumeAfterLoginDialogActionTaken_WasPostponed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isHMDMode() && getDesktopTabletBecomesToolbarSetting()) {
|
||||
auto toolbar = DependencyManager::get<ToolbarScriptingInterface>()->getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
toolbar->writeProperty("visible", true);
|
||||
|
@ -5535,8 +5540,6 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
|||
menu->getMenu("Developer")->setVisible(_developerMenuVisible);
|
||||
_myCamera.setMode(_previousCameraMode);
|
||||
cameraModeChanged();
|
||||
|
||||
_resumeAfterLoginDialogActionTakenWasCalled = true;
|
||||
}
|
||||
|
||||
void Application::loadAvatarScripts(const QVector<QString>& urls) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Application.h
|
||||
// interface/src
|
||||
//
|
||||
|
@ -803,7 +803,7 @@ private:
|
|||
bool _showTrackedObjects { false };
|
||||
bool _prevShowTrackedObjects { false };
|
||||
|
||||
// Whether resumeAfterLoginDialogActionTaken() has been called
|
||||
bool _resumeAfterLoginDialogActionTakenWasCalled { false };
|
||||
bool _resumeAfterLoginDialogActionTaken_WasPostponed { false };
|
||||
bool _resumeAfterLoginDialogActionTaken_SafeToRun { false };
|
||||
};
|
||||
#endif // hifi_Application_h
|
||||
|
|
Loading…
Reference in a new issue