summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-11-17 15:57:04 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-11-26 07:22:09 +0000
commit61fc55b5b650663a048f0bb692e0f02b545beb6b (patch)
tree7e25edd8cdc4dcf588f735c2421170d5b3e976f8 /src/libs
parente31fd6c6b68b546771b4d56da36bf3e287448f49 (diff)
Fix blocking UI when waiting start of the authorization fallback process
Instead of constantly checking (busy waiting) if the server was started, perform the task in a local event loop. Task-number: QTIFW-2374 Change-Id: I7ddf63014c0cf0a187085339a5394186b0245a63 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/remoteclient_p.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libs/installer/remoteclient_p.h b/src/libs/installer/remoteclient_p.h
index 9cc679de8..e1809e0af 100644
--- a/src/libs/installer/remoteclient_p.h
+++ b/src/libs/installer/remoteclient_p.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -39,7 +39,8 @@
#include "constants.h"
#include <QCoreApplication>
-#include <QElapsedTimer>
+#include <QDeadlineTimer>
+#include <QTimer>
#include <QMutex>
#include <QThread>
@@ -165,11 +166,19 @@ public:
}
if (started) {
- QElapsedTimer t;
- t.start();
+ QTimer timer;
+ QEventLoop loop;
// 30 seconds waiting ought to be enough for the app to start
- while ((!m_serverStarted) && (t.elapsed() < 30000))
+ QDeadlineTimer deadline(30000);
+
+ connect(&timer, &QTimer::timeout, [&]() {
m_serverStarted = authorize();
+ if (m_serverStarted || deadline.hasExpired())
+ loop.quit();
+ });
+
+ timer.start(100);
+ loop.exec();
}
}