diff --git a/app/backend/computermanager.cpp b/app/backend/computermanager.cpp index abbbbb3c..5461872d 100644 --- a/app/backend/computermanager.cpp +++ b/app/backend/computermanager.cpp @@ -130,8 +130,12 @@ private: emit computerStateChanged(m_Computer); } - // Wait a bit to poll again - QThread::sleep(3); + // Wait a bit to poll again, but do it in 100 ms chunks + // so we can be interrupted reasonably quickly. + // FIXME: QWaitCondition would be better. + for (int i = 0; i < 30 && !isInterruptionRequested(); i++) { + QThread::msleep(100); + } } } diff --git a/app/backend/nvhttp.cpp b/app/backend/nvhttp.cpp index e3484f03..4f7038c1 100644 --- a/app/backend/nvhttp.cpp +++ b/app/backend/nvhttp.cpp @@ -447,6 +447,7 @@ NvHTTP::openConnection(QUrl baseUrl, // Run the request with a timeout if requested QEventLoop loop; connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), &loop, SLOT(quit())); if (timeoutMs) { QTimer::singleShot(timeoutMs, &loop, SLOT(quit())); }