Fix crash in qmake parsing

The read from a QHash needs to be protected too if other threads are
writing.

sync-up with qtc, no actual effect on qmake itself.

Fixes: QTCREATORBUG-21416
Change-Id: I75e5634e11b10056d6dbb6fdceef482ca2222ca1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from qtcreator/5f79b5d2e5e33321cdcd00362f0d6d9442a73ec2)
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Allan Sandfeld Jensen 2018-11-27 09:39:56 +01:00
parent 09e3457541
commit 1f998e040e
1 changed files with 2 additions and 2 deletions

View File

@ -109,10 +109,10 @@ int QMakeVfs::idForFileName(const QString &fn, VfsFlags flags)
return id;
}
#endif
if (!(flags & VfsAccessedOnly)) {
#ifdef PROPARSER_THREAD_SAFE
QMutexLocker locker(&s_mutex);
QMutexLocker locker(&s_mutex);
#endif
if (!(flags & VfsAccessedOnly)) {
int &id = s_fileIdMap[fn];
if (!id) {
id = ++s_fileIdCounter;