summaryrefslogtreecommitdiffstats
path: root/src/linguist/shared/qmakeparser.cpp
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-12-18 14:44:46 +0000
commitedeeff0e93fb2f7a57dc7e5856b2f0cabb54060d (patch)
treeddc97598217e344ac0987e3c4cce2e2fc9c3df2b /src/linguist/shared/qmakeparser.cpp
parentd5f5b1fd88c85bd39c6189f6e1a84b1fa9921e23 (diff)
QmakeProject: Fix crash on updating sources
this doesn't actually do anything in linguist, as it's single-threaded. Change-Id: I9df2079087af6bd0d35dd121db6222e8a6ec9389 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> (cherry picked from qtcreator/dedcd25924743e494055c1e0195aeef0f3983a1d) (cherry picked from qtcreator/b335b2a083e456e2b44b1e9454a0f4cd41e2a397) (cherry picked from qtcreator/a027cbcd7051c634a51b6029dcb8a5b4bfe8b046)
Diffstat (limited to 'src/linguist/shared/qmakeparser.cpp')
-rw-r--r--src/linguist/shared/qmakeparser.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/linguist/shared/qmakeparser.cpp b/src/linguist/shared/qmakeparser.cpp
index dff40f48f..48e2f5a54 100644
--- a/src/linguist/shared/qmakeparser.cpp
+++ b/src/linguist/shared/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)