mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Fixed deadlock on start with recent Qt versions
This commit is contained in:
parent
8b9cd84df7
commit
28079eb2df
2 changed files with 18 additions and 1 deletions
|
@ -977,6 +977,12 @@ QSharedPointer<OffscreenUi> getOffscreenUI() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::initMenu() {
|
||||||
|
_isMenuInitialized = false;
|
||||||
|
qApp->getWindow()->menuBar();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Application::Application(
|
Application::Application(
|
||||||
int& argc, char** argv,
|
int& argc, char** argv,
|
||||||
const QCommandLineParser& parser,
|
const QCommandLineParser& parser,
|
||||||
|
@ -985,6 +991,8 @@ Application::Application(
|
||||||
) :
|
) :
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new MainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
|
// Menu needs to be initialized before other initializers. Otherwise deadlock happens on qApp->getWindow()->menuBar().
|
||||||
|
_isMenuInitialized(initMenu()),
|
||||||
_sessionRunTimer(startupTimer),
|
_sessionRunTimer(startupTimer),
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
_logger(new FileLogger(this)),
|
_logger(new FileLogger(this)),
|
||||||
|
@ -1017,7 +1025,6 @@ Application::Application(
|
||||||
_snapshotSound(nullptr),
|
_snapshotSound(nullptr),
|
||||||
_sampleSound(nullptr)
|
_sampleSound(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
|
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
|
||||||
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
|
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
|
||||||
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
|
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
|
||||||
|
@ -4225,6 +4232,11 @@ bool Application::event(QEvent* event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This helps avoid deadlock issue early during Application initialization
|
||||||
|
if (!_isMenuInitialized) {
|
||||||
|
return QApplication::event(event);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Menu::getInstance()) {
|
if (!Menu::getInstance()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -562,6 +562,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
bool initMenu();
|
||||||
void pauseUntilLoginDetermined();
|
void pauseUntilLoginDetermined();
|
||||||
void resumeAfterLoginDialogActionTaken();
|
void resumeAfterLoginDialogActionTaken();
|
||||||
bool handleKeyEventForFocusedEntity(QEvent* event);
|
bool handleKeyEventForFocusedEntity(QEvent* event);
|
||||||
|
@ -626,6 +627,10 @@ private:
|
||||||
void userKickConfirmation(const QUuid& nodeID, unsigned int banFlags = ModerationFlags::getDefaultBanFlags());
|
void userKickConfirmation(const QUuid& nodeID, unsigned int banFlags = ModerationFlags::getDefaultBanFlags());
|
||||||
|
|
||||||
MainWindow* _window;
|
MainWindow* _window;
|
||||||
|
|
||||||
|
// _isMenuInitialized: used to initialize menu early enough before it's needed by other
|
||||||
|
// initializers. Fixes a deadlock issue with recent Qt versions.
|
||||||
|
bool _isMenuInitialized;
|
||||||
QElapsedTimer& _sessionRunTimer;
|
QElapsedTimer& _sessionRunTimer;
|
||||||
|
|
||||||
bool _aboutToQuit { false };
|
bool _aboutToQuit { false };
|
||||||
|
|
Loading…
Reference in a new issue