From 604d86ed07711651bc71871f6d37a794d916da6a Mon Sep 17 00:00:00 2001 From: Eran Mizrahi Date: Wed, 13 Dec 2017 17:39:59 +0200 Subject: Improve responsiveness of unlock button --- src/organizercore.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index c4bcaf3d..dd77f19a 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1340,16 +1340,17 @@ bool OrganizerCore::waitForProcessCompletion(HANDLE handle, LPDWORD exitCode, IL newHandle = false; } - // keep processing events so the app doesn't appear dead - QCoreApplication::processEvents(); - // Wait for a an event on the handle, a key press, mouse click or timeout - res = MsgWaitForMultipleObjects(1, &handle, FALSE, 500, QS_KEY | QS_MOUSEBUTTON); + res = MsgWaitForMultipleObjects(1, &handle, FALSE, 200, QS_KEY | QS_MOUSEBUTTON); if (res == WAIT_FAILED) { qWarning() << "Failed waiting for process completion : MsgWaitForMultipleObjects WAIT_FAILED" << GetLastError(); break; } + // keep processing events so the app doesn't appear dead + QCoreApplication::sendPostedEvents(); + QCoreApplication::processEvents(); + if (uilock && uilock->unlockForced()) { uiunlocked = true; break; @@ -1364,7 +1365,11 @@ bool OrganizerCore::waitForProcessCompletion(HANDLE handle, LPDWORD exitCode, IL originalHandle = false; // if the previous process spawned a child process and immediately exits we may miss it if we check immediately - QThread::msleep(500); + for (int i = 0; i < 3; ++i) { + QThread::msleep(200); + QCoreApplication::sendPostedEvents(); + QCoreApplication::processEvents(); + } // search if there is another usvfs process active and if so wait for it handle = findAndOpenAUSVFSProcess(); -- cgit v1.3.1