Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -977,6 +977,12 @@ QSharedPointer<OffscreenUi> getOffscreenUI() { · 976 unmodified lines | |||
| 977 | #endif | 977 | #endif |
| 978 | } | 978 | } |
| 979 | 979 | ||
| 980 | bool Application::initMenu() { | ||
| 981 | _isMenuInitialized = false; | ||
| 982 | qApp->getWindow()->menuBar(); | ||
| 983 | return true; | ||
| 984 | } | ||
| 985 | |||
| 980 | Application::Application( | 986 | Application::Application( |
| 981 | int& argc, char** argv, | 987 | int& argc, char** argv, |
| 982 | const QCommandLineParser& parser, | 988 | const QCommandLineParser& parser, |
| @@ -985,6 +991,8 @@ Application::Application( · 2 unmodified lines | |||
| 985 | ) : | 991 | ) : |
| 986 | QApplication(argc, argv), | 992 | QApplication(argc, argv), |
| 987 | _window(new MainWindow(desktop())), | 993 | _window(new MainWindow(desktop())), |
| 994 | // Menu needs to be initialized before other initializers. Otherwise deadlock happens on qApp->getWindow()->menuBar(). | ||
| 995 | _isMenuInitialized(initMenu()), | ||
| 988 | _sessionRunTimer(startupTimer), | 996 | _sessionRunTimer(startupTimer), |
| 989 | #ifndef Q_OS_ANDROID | 997 | #ifndef Q_OS_ANDROID |
| 990 | _logger(new FileLogger(this)), | 998 | _logger(new FileLogger(this)), |
| @@ -1017,7 +1025,6 @@ Application::Application( · 26 unmodified lines | |||
| 1017 | _snapshotSound(nullptr), | 1025 | _snapshotSound(nullptr), |
| 1018 | _sampleSound(nullptr) | 1026 | _sampleSound(nullptr) |
| 1019 | { | 1027 | { |
| 1020 | |||
| 1021 | auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); | 1028 | auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); |
| 1022 | setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); | 1029 | setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); |
| 1023 | setProperty(hifi::properties::CRASHED, _previousSessionCrashed); | 1030 | setProperty(hifi::properties::CRASHED, _previousSessionCrashed); |
| @@ -4225,6 +4232,11 @@ bool Application::event(QEvent* event) { · 3201 unmodified lines | |||
| 4225 | return false; | 4232 | return false; |
| 4226 | } | 4233 | } |
| 4227 | 4234 | ||
| 4235 | // This helps avoid deadlock issue early during Application initialization | ||
| 4236 | if (!_isMenuInitialized) { | ||
| 4237 | return QApplication::event(event); | ||
| 4238 | } | ||
| 4239 | |||
| 4228 | if (!Menu::getInstance()) { | 4240 | if (!Menu::getInstance()) { |
| 4229 | return false; | 4241 | return false; |
| 4230 | } | 4242 | } |