From 791a5c87a7df396bc00eb8202585561b40bb8adc Mon Sep 17 00:00:00 2001 From: Tobias Markmann <tm@ayena.de> Date: Tue, 19 Jul 2016 20:39:11 +0200 Subject: Fix Swift UI sometimes getting stuck during login In some cases during the login the helper QEventLoop in QtWebKitChatView takes over the event handling of the application and never retirms from it. Qt events are still handled in this case but any other new events are only queued up. The user would still have a responsible UI, but all network traffic or other non-Qt events would not be handled correctly. Test-Information: Without the patch Swift would get stuck during login in 5 of 10 runs. With this patch it did not get stuck anymore in 10 runs. Tested on OS X 10.11.5 with Qt 5.5.1. Change-Id: Ie17a8e01cc9c52cc784e223974ec21e604dcccab diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index aec8589..afa2d5e 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -329,11 +329,7 @@ void QtWebKitChatView::resetView() { connect(webView_, SIGNAL(loadFinished(bool)), &syncLoop, SLOT(quit())); webPage_->mainFrame()->setHtml(pageHTML); while (!viewReady_) { - QTimer t; - t.setSingleShot(true); - connect(&t, SIGNAL(timeout()), &syncLoop, SLOT(quit())); - t.start(50); - syncLoop.exec(); + syncLoop.processEvents(QEventLoop::AllEvents, 50); } document_ = webPage_->mainFrame()->documentElement(); -- cgit v0.10.2-6-g49f6