diff options
| author | AL <26797547+Al12rs@users.noreply.github.com> | 2020-06-07 17:44:06 +0200 |
|---|---|---|
| committer | AL <26797547+Al12rs@users.noreply.github.com> | 2020-06-07 17:44:06 +0200 |
| commit | d1c42e69c1819def3098bfac0fd96f2eb39226e9 (patch) | |
| tree | 028dea7baf8d3e7f4e4012b4454ce5a1fc4f20c9 | |
| parent | 0dc66e7ff4e4561d7b7f9ffbc3158a0e1bf5a2ec (diff) | |
Make even the last direct call to checkForProblemsImpl use the async version.
| -rw-r--r-- | src/mainwindow.cpp | 14 | ||||
| -rw-r--r-- | src/mainwindow.h | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9559583b..4a5175e6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1098,15 +1098,15 @@ bool MainWindow::errorReported(QString &logFile) return false; } -void MainWindow::checkForProblemsAsync() { - QtConcurrent::run([this]() { - checkForProblems(); +QFuture<void> MainWindow::checkForProblemsAsync() { + return QtConcurrent::run([this]() { + checkForProblemsImpl(); }); } -void MainWindow::checkForProblems() +void MainWindow::checkForProblemsImpl() { - TimeThis tt("MainWindow::checkForProblems()"); + TimeThis tt("MainWindow::checkForProblemsImpl()"); { QMutexLocker lk(&m_CheckForProblemsMutex); if (m_CheckingForProblems) { @@ -5886,7 +5886,9 @@ void MainWindow::on_bsaList_itemChanged(QTreeWidgetItem*, int) void MainWindow::on_actionNotifications_triggered() { - checkForProblems(); + auto future = checkForProblemsAsync(); + + future.waitForFinished(); ProblemsDialog problems(m_PluginContainer.plugins<QObject>(), this); problems.exec(); diff --git a/src/mainwindow.h b/src/mainwindow.h index ac172474..14987c0d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -248,7 +248,7 @@ private: bool extractProgress(QProgressDialog &extractProgress, int percentage, std::string fileName); // Performs checks, sets the m_NumberOfProblems and signals checkForProblemsDone(). - void checkForProblems(); + void checkForProblemsImpl(); void setCategoryListVisible(bool visible); @@ -535,7 +535,7 @@ private slots: void scheduleCheckForProblems(); // Perform the actual problem check in another thread. - void checkForProblemsAsync(); + QFuture<void> checkForProblemsAsync(); void saveModMetas(); |
