QFileSystemModel: Wake file info gatherer thread up before waiting on it

Amends 0786c17bbc, which added a number
of attempts to gracefully shut down the QFileInfoGatherer thread while
shutting down a QFileSystemModel. This introduced a 1-second wait upon
destruction of the model when the QFileInfoGatherer thread is waiting
for an unset wait condition.

Instead of QThread::requestInteruption() to make the thread exit, use
QFileInfoGatherer::requestAbort(), which calls requestInteruption() but
also sets the wait condition afterwards to make sure that the thread
wakes up and checks the abort condition.

Pick-to: 6.6 6.7
Fixes: QTBUG-124164
Change-Id: I560f2131f226e0bb59f72e558cbab55b89cfb144
Reviewed-by: David Faure <david.faure@kdab.com>
bb10
Volker Hilsheimer 2024-04-08 11:48:20 +02:00
parent ae361f00b3
commit a79ca35abe
1 changed files with 1 additions and 1 deletions

View File

@ -2079,7 +2079,7 @@ QFileSystemModelPrivate::QFileSystemModelPrivate()
QFileSystemModelPrivate::~QFileSystemModelPrivate()
{
#if QT_CONFIG(filesystemwatcher)
fileInfoGatherer->requestInterruption();
fileInfoGatherer->requestAbort();
if (!fileInfoGatherer->wait(1000)) {
// If the thread hangs, perhaps because the network was disconnected
// while the gatherer was stat'ing a remote file, then don't block