From 96868447ce0575caf37764dba2782e8855849bc5 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 6 Feb 2020 18:13:38 +0100 Subject: [PATCH] QmakeProjectManager: Make sure we reset the ProFileCacheManager Otherwise, we can get an assertion when exiting during a parse. Change-Id: I3a2a1fbb854662b77b2e1485a9097b9f39d94fe2 Reviewed-by: hjk --- .../qmakeprojectmanager/qmakeproject.cpp | 19 ++++++++++++++----- .../qmakeprojectmanager/qmakeproject.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 5e6bcb4a24d..c8473198e73 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -238,6 +238,10 @@ QmakeBuildSystem::~QmakeBuildSystem() // Make sure root node (and associated readers) are shut hown before proceeding m_rootProFile.reset(); + if (m_qmakeGlobalsRefCnt > 0) { + m_qmakeGlobalsRefCnt = 0; + deregisterFromCacheManager(); + } m_cancelEvaluate = true; QTC_CHECK(m_qmakeGlobalsRefCnt == 0); @@ -733,16 +737,21 @@ void QmakeBuildSystem::destroyProFileReader(QtSupport::ProFileReader *reader) [reader] { delete reader; }); onFinished(deleteFuture, this, [this](const QFuture &) { if (!--m_qmakeGlobalsRefCnt) { - QString dir = projectFilePath().toString(); - if (!dir.endsWith(QLatin1Char('/'))) - dir += QLatin1Char('/'); - QtSupport::ProFileCacheManager::instance()->discardFiles(dir, qmakeVfs()); - QtSupport::ProFileCacheManager::instance()->decRefCount(); + deregisterFromCacheManager(); m_qmakeGlobals.reset(); } }); } +void QmakeBuildSystem::deregisterFromCacheManager() +{ + QString dir = projectFilePath().toString(); + if (!dir.endsWith(QLatin1Char('/'))) + dir += QLatin1Char('/'); + QtSupport::ProFileCacheManager::instance()->discardFiles(dir, qmakeVfs()); + QtSupport::ProFileCacheManager::instance()->decRefCount(); +} + void QmakeBuildSystem::activeTargetWasChanged(Target *t) { // We are only interested in our own target. diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h index 61df4e41760..9cd8902dbbf 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.h +++ b/src/plugins/qmakeprojectmanager/qmakeproject.h @@ -139,6 +139,7 @@ public: QString qmakeSysroot(); /// \internal void destroyProFileReader(QtSupport::ProFileReader *reader); + void deregisterFromCacheManager(); /// \internal void scheduleAsyncUpdateFile(QmakeProFile *file,