Fix race condition in ~QFileInfoGatherer

tst_qfilesystemmodel was hanging regularly. In
QFileInfoGatherer::~QFileInfoGatherer() it would be stuck on wait() and
in QFileInfoGatherer::run() it would be at condition.wait(&mutex);

It looks like while abort was set to true, the while in run() had just
entered so that it would wait for condition indefinitely.

Task-number: QTBUG-29403

Change-Id: If6cebbc98ec7f54fbdf347804780bbfc5e177b3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
bb10
Frederik Gladhorn 2013-10-01 17:11:53 +02:00 committed by The Qt Project
parent c74f60b09d
commit d14abab0d3
1 changed files with 2 additions and 0 deletions

View File

@ -94,7 +94,9 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
QFileInfoGatherer::~QFileInfoGatherer()
{
abort.store(true);
QMutexLocker locker(&mutex);
condition.wakeAll();
locker.unlock();
wait();
}