Create Application before ConcurrentTimerEnvironment.

Fixes #5498.
This commit is contained in:
John Preston 2018-12-26 13:02:43 +04:00
parent 7b5e5c2587
commit cfac261516
3 changed files with 15 additions and 8 deletions

View File

@ -103,10 +103,13 @@ Application::Application(
char **argv)
: QApplication(argc, argv)
, _mainThreadId(QThread::currentThreadId())
, _launcher(launcher)
, _updateChecker(Core::UpdaterDisabled()
? nullptr
: std::make_unique<Core::UpdateChecker>()) {
, _launcher(launcher) {
}
int Application::execute() {
if (!Core::UpdaterDisabled()) {
_updateChecker = std::make_unique<Core::UpdateChecker>();
}
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
char h[33] = { 0 };
hashMd5Hex(d.constData(), d.size(), h);
@ -134,6 +137,8 @@ Application::Application(
LOG(("Connecting local socket to %1...").arg(_localServerName));
_localSocket.connectToServer(_localServerName);
}
return exec();
}
Application::~Application() = default;

View File

@ -21,7 +21,7 @@ class Application : public QApplication, private QAbstractNativeEventFilter {
public:
Application(not_null<Core::Launcher*> launcher, int &argc, char **argv);
bool event(QEvent *e) override;
int execute();
void createMessenger();
void refreshGlobalProxy();
@ -49,6 +49,9 @@ public slots:
void startApplication(); // will be done in exec()
void closeApplication(); // will be done in aboutToQuit()
protected:
bool event(QEvent *e) override;
private:
typedef QPair<QLocalSocket*, QByteArray> LocalClient;
typedef QList<LocalClient> LocalClients;

View File

@ -243,11 +243,10 @@ void Launcher::processArguments() {
}
int Launcher::executeApplication() {
Application application(this, _argc, _argv);
MainQueueProcessor processor;
base::ConcurrentTimerEnvironment environment;
Application app(this, _argc, _argv);
return app.exec();
return application.execute();
}
} // namespace Core