diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index 856b703e96e..246afb1d485 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -63,13 +63,14 @@ void ProFileCache::discardFile(const QString &fileName) if (it != parsed_files.end()) { #ifdef PROPARSER_THREAD_SAFE if (it->locker) { - if (!it->locker->done) + if (!it->locker->done) { + ++it->locker->waiters; it->locker->cond.wait(&mutex); - do { - lck.unlock(); - QThread::sleep(100); - lck.relock(); - } while (it->locker); + if (!--it->locker->waiters) { + delete it->locker; + it->locker = 0; + } + } } #endif if (it->pro) @@ -90,13 +91,14 @@ void ProFileCache::discardFiles(const QString &prefix) if (it.key().startsWith(prefix)) { #ifdef PROPARSER_THREAD_SAFE if (it->locker) { - if (!it->locker->done) + if (!it->locker->done) { + ++it->locker->waiters; it->locker->cond.wait(&mutex); - do { - lck.unlock(); - QThread::sleep(100); - lck.relock(); - } while (it->locker); + if (!--it->locker->waiters) { + delete it->locker; + it->locker = 0; + } + } } #endif if (it->pro) @@ -107,7 +109,6 @@ void ProFileCache::discardFiles(const QString &prefix) } } - ////////// Parser /////////// #define fL1S(s) QString::fromLatin1(s)