summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager_test.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-11-10 17:55:54 +0100
committerEike Ziller <eike.ziller@qt.io>2020-11-11 12:49:33 +0000
commit6d7e5eb8d17194b124c8986d670ff96fda96f0f3 (patch)
treed798aee5f50a97d59dd3458afdceb04c0978fbe7 /src/plugins/cpptools/cppmodelmanager_test.cpp
parent557a09ba4c4c232f1f7095ed9c6889f0abc919f0 (diff)
downloadqt-creator-6d7e5eb8d17194b124c8986d670ff96fda96f0f3.tar.gz
Fix CppProjectUpdater cancelAndWaitForFinished
The code was pushing an additional QFutureInterface through the whole chain of functions, which was used for canceling. But since it was never started (and never finished, and never used for reporting results), calling waitForFinshed on it never had any effect with Qt5 and locks up with Qt6. Instead of using a separate QFutureInterface, use the actual QFuture that is available and intended for it. Fixes: QTCREATORBUG-24902 Change-Id: I5a49bcecc9cf70fbffa93aee4293004f9369df58 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager_test.cpp')
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index 78de5f1583..2b77700cb8 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -190,8 +190,7 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
{testDataDir.frameworksDir(false), HeaderPathType::Framework}};
pi.appendProjectPart(part);
- QFutureInterface<void> dummy;
- mm->updateProjectInfo(dummy, pi);
+ mm->updateProjectInfo(pi);
ProjectExplorer::HeaderPaths headerPaths = mm->headerPaths();
QCOMPARE(headerPaths.size(), 2);
@@ -223,8 +222,7 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
part->files << ProjectFile(source, ProjectFile::CXXSource);
pi.appendProjectPart(part);
- QFutureInterface<void> dummy;
- mm->updateProjectInfo(dummy, pi).waitForFinished();
+ mm->updateProjectInfo(pi).waitForFinished();
QCoreApplication::processEvents();
QVERIFY(mm->snapshot().contains(source));
@@ -323,8 +321,7 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times()
part->files.append(ProjectFile(testHeader2, ProjectFile::CXXHeader));
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part);
- QFutureInterface<void> dummy;
- mm->updateProjectInfo(dummy, pi);
+ mm->updateProjectInfo(pi);
CPlusPlus::Snapshot snapshot;
QSet<QString> refreshedFiles;
@@ -387,8 +384,7 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes()
// Reindexing triggers a reparsing thread
helper.resetRefreshedSourceFiles();
- QFutureInterface<void> dummy;
- QFuture<void> firstFuture = mm->updateProjectInfo(dummy, pi);
+ QFuture<void> firstFuture = mm->updateProjectInfo(pi);
QVERIFY(firstFuture.isStarted() || firstFuture.isRunning());
firstFuture.waitForFinished();
const QSet<QString> refreshedFiles = helper.waitForRefreshedSourceFiles();
@@ -396,7 +392,7 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes()
QVERIFY(refreshedFiles.contains(testCpp));
// No reindexing since nothing has changed
- QFuture<void> subsequentFuture = mm->updateProjectInfo(dummy, pi);
+ QFuture<void> subsequentFuture = mm->updateProjectInfo(pi);
QVERIFY(subsequentFuture.isCanceled() && subsequentFuture.isFinished());
}