summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@theqtcompany.com>2015-07-16 17:42:08 +0200
committerDaniel Teske <daniel.teske@theqtcompany.com>2015-07-22 13:07:48 +0000
commitdedcd25924743e494055c1e0195aeef0f3983a1d (patch)
tree4348b82d2ec1f3882104472f28995382bd41965b
parent518720e06e06a77d1309f9e6da962fc9608c1f38 (diff)
downloadqt-creator-dedcd25924743e494055c1e0195aeef0f3983a1d.tar.gz
QmakeProject: Fix crash on updating sources
ProFileCacheManager::discardFile(s) may remove an entry from the ProfileCache only when it is unused (which is the case iff ent->locker is zero). Change-Id: I9df2079087af6bd0d35dd121db6222e8a6ec9389 Task-number: QTCREATORBUG-14730 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/shared/proparser/qmakeparser.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp
index 070d8fe6a1..28810b7eca 100644
--- a/src/shared/proparser/qmakeparser.cpp
+++ b/src/shared/proparser/qmakeparser.cpp
@@ -61,6 +61,15 @@ void ProFileCache::discardFile(const QString &fileName)
#endif
QHash<QString, Entry>::Iterator it = parsed_files.find(fileName);
if (it != parsed_files.end()) {
+ if (it->locker) {
+ if (!it->locker->done)
+ it->locker->cond.wait(&mutex);
+ do {
+ lck.unlock();
+ QThread::sleep(100);
+ lck.relock();
+ } while (it->locker);
+ }
if (it->pro)
it->pro->deref();
parsed_files.erase(it);
@@ -77,6 +86,15 @@ void ProFileCache::discardFiles(const QString &prefix)
end = parsed_files.end();
while (it != end)
if (it.key().startsWith(prefix)) {
+ if (it->locker) {
+ if (!it->locker->done)
+ it->locker->cond.wait(&mutex);
+ do {
+ lck.unlock();
+ QThread::sleep(100);
+ lck.relock();
+ } while (it->locker);
+ }
if (it->pro)
it->pro->deref();
it = parsed_files.erase(it);