QmakeProjectManager: Make sure we reset the ProFileCacheManager

Otherwise, we can get an assertion when exiting during a parse.

Change-Id: I3a2a1fbb854662b77b2e1485a9097b9f39d94fe2
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-02-06 18:13:38 +01:00
parent beed0c7396
commit 96868447ce
2 changed files with 15 additions and 5 deletions

View File

@@ -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<void> &) {
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.

View File

@@ -139,6 +139,7 @@ public:
QString qmakeSysroot();
/// \internal
void destroyProFileReader(QtSupport::ProFileReader *reader);
void deregisterFromCacheManager();
/// \internal
void scheduleAsyncUpdateFile(QmakeProFile *file,