From f8cf71e4ba6adb6f25611f7412748b530a3d955b Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 14 Mar 2024 20:30:24 +0100 Subject: [PATCH] Help: Don't crash on shutdown when (un)registedDocumentationNow() Put the future into the future synchronizer. Otherwise, when (un)registedDocumentationNow() is still executed on shutdown we are destroying the locked mutex and crash. Change-Id: Ic8e7f8252719a3015101a0f5fc7b48ba57956562 Reviewed-by: Eike Ziller --- src/plugins/help/helpmanager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp index 7ec80e700d5..a117afd916a 100644 --- a/src/plugins/help/helpmanager.cpp +++ b/src/plugins/help/helpmanager.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include #include #include @@ -138,6 +140,7 @@ void HelpManager::registerDocumentation(const QStringList &files) } QFuture future = Utils::asyncRun(®isterDocumentationNow, collectionFilePath(), files); + ExtensionSystem::PluginManager::futureSynchronizer()->addFuture(future); Utils::onResultReady(future, this, [](bool docsChanged){ if (docsChanged) { d->m_helpEngine->setupData(); @@ -200,6 +203,7 @@ void HelpManager::unregisterDocumentation(const QStringList &files) d->m_userRegisteredFiles.subtract(Utils::toSet(files)); QFuture future = Utils::asyncRun(&unregisterDocumentationNow, collectionFilePath(), files); + ExtensionSystem::PluginManager::futureSynchronizer()->addFuture(future); Utils::onResultReady(future, this, [](bool docsChanged){ if (docsChanged) { d->m_helpEngine->setupData();