From d14abab0d3c4d51077f9169f4a09ba3202eaa4a7 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 1 Oct 2013 17:11:53 +0200 Subject: [PATCH] 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 Reviewed-by: Olivier Goffart Reviewed-by: Gabriel de Dietrich --- src/widgets/dialogs/qfileinfogatherer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 0f12c2b80e..c06ef0c474 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -94,7 +94,9 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) QFileInfoGatherer::~QFileInfoGatherer() { abort.store(true); + QMutexLocker locker(&mutex); condition.wakeAll(); + locker.unlock(); wait(); }