From 61fc55b5b650663a048f0bb692e0f02b545beb6b Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Wed, 17 Nov 2021 15:57:04 +0200 Subject: 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 Reviewed-by: Katja Marttila --- src/libs/installer/remoteclient_p.h | 19 ++++++++++++++----- 1 file 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 -#include +#include +#include #include #include @@ -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(); } } -- cgit v1.2.3