From cc6df4e7074f513f3ec3be9909b6f29e3419a4a8 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 12 Feb 2021 16:12:15 +0100 Subject: [PATCH] ClassView: Clear the documentCache, too, when reset was requested Otherwise when we switch session we still keep the data about the old session in the cache, which is pointless. Protect clearing both caches with both mutexes, so it comes atomically. Task-number: QTCREATORBUG-25317 Change-Id: Ic5bc7ae2b8640e9290024e00c394ca9608f88da9 Reviewed-by: Christian Kandeler --- src/plugins/classview/classviewparser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp index 051d9e4be24..3022a8071e8 100644 --- a/src/plugins/classview/classviewparser.cpp +++ b/src/plugins/classview/classviewparser.cpp @@ -549,12 +549,10 @@ void Parser::removeFiles(const QStringList &fileList) void Parser::resetData(const CPlusPlus::Snapshot &snapshot) { { - QWriteLocker locker(&d->m_projectLock); + QWriteLocker projectLocker(&d->m_projectLock); + QWriteLocker documentLocker(&d->m_documentLock); d->m_projectCache.clear(); - } - - { - QWriteLocker locker(&d->m_documentLock); + d->m_documentCache.clear(); for (auto it = snapshot.begin(); it != snapshot.end(); ++it) d->m_documentCache[it.key().toString()].document = it.value(); }