summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@theqtcompany.com>2015-07-16 17:42:08 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-27 17:53:50 +0000
commite59d39c6fd96bff7466cf655f4b67e83edf50d6e (patch)
treefd67a0f26fc3566f0e2b40762e38c5a484524be5 /qmake
parent69032adda0bf10bb51a44bbfc87752608a5f86a6 (diff)
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> (cherry picked from qtcreator/dedcd25924743e494055c1e0195aeef0f3983a1d) (cherry picked from qtcreator/b335b2a083e456e2b44b1e9454a0f4cd41e2a397) (cherry picked from qtcreator/a027cbcd7051c634a51b6029dcb8a5b4bfe8b046) Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/library/qmakeparser.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 3fd7957bc0..95a072392e 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -64,6 +64,18 @@ void ProFileCache::discardFile(const QString &fileName)
#endif
QHash<QString, Entry>::Iterator it = parsed_files.find(fileName);
if (it != parsed_files.end()) {
+#ifdef PROPARSER_THREAD_SAFE
+ if (it->locker) {
+ if (!it->locker->done) {
+ ++it->locker->waiters;
+ it->locker->cond.wait(&mutex);
+ if (!--it->locker->waiters) {
+ delete it->locker;
+ it->locker = 0;
+ }
+ }
+ }
+#endif
if (it->pro)
it->pro->deref();
parsed_files.erase(it);
@@ -80,6 +92,18 @@ void ProFileCache::discardFiles(const QString &prefix)
end = parsed_files.end();
while (it != end)
if (it.key().startsWith(prefix)) {
+#ifdef PROPARSER_THREAD_SAFE
+ if (it->locker) {
+ if (!it->locker->done) {
+ ++it->locker->waiters;
+ it->locker->cond.wait(&mutex);
+ if (!--it->locker->waiters) {
+ delete it->locker;
+ it->locker = 0;
+ }
+ }
+ }
+#endif
if (it->pro)
it->pro->deref();
it = parsed_files.erase(it);
@@ -88,7 +112,6 @@ void ProFileCache::discardFiles(const QString &prefix)
}
}
-
////////// Parser ///////////
#define fL1S(s) QString::fromLatin1(s)