Commit 96630673 authored by dt's avatar dt
Browse files

Fix deadlock in .pro file evaluation.

We used to indicate that the cache for a file is up to date by having a
Entry with ent->locker == 0. But we first wake up all threads and only
after all the threads who waited for that parse to complete we set
ent->locker to zero. Thus a different thread could get the impression
that it needs to wait for the parse thread, yet get no wake up.

We need a different flag to indicate that we are actually already done
parsing and the cache can simply be used instead of waiting for a wake

Reviewed-By: ossi
parent b6fda5be
......@@ -3031,7 +3031,7 @@ ProFile *ProFileEvaluator::Private::parsedProFile(const QString &fileName, bool
if (it != m_option->cache->parsed_files.end()) {
ent = &*it;
if (ent->locker) {
if (ent->locker && !ent->locker->done) {
......@@ -3061,6 +3061,7 @@ ProFile *ProFileEvaluator::Private::parsedProFile(const QString &fileName, bool
if (ent->locker->waiters) {
ent->locker->done = true;
} else {
delete ent->locker;
......@@ -123,9 +123,10 @@ private:
ProFile *pro;
struct Locker {
Locker() : waiters(0) {}
Locker() : waiters(0), done(false) {}
QWaitCondition cond;
int waiters;
bool done;
Locker *locker;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment