Commit dedcd259 authored by Daniel Teske's avatar Daniel Teske
Browse files

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: default avatarOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
parent 518720e0
......@@ -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);
......
Markdown is supported
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