From 32270a1276ee6721e6de9c44d71ed9052d3b2472 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 8 Apr 2024 11:48:20 +0200 Subject: [PATCH] QFileSystemModel: Wake file info gatherer thread up before waiting on it Amends 0786c17bbc556a0f494fc825af47c604a9dc0241, 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 Fixes: QTBUG-124164 Change-Id: I560f2131f226e0bb59f72e558cbab55b89cfb144 Reviewed-by: David Faure (cherry picked from commit a79ca35abef38f882a1ab574063eb9ed6ffe6846) Reviewed-by: Qt Cherry-pick Bot --- src/gui/itemmodels/qfilesystemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp index 115d22de2a5..db99029e63e 100644 --- a/src/gui/itemmodels/qfilesystemmodel.cpp +++ b/src/gui/itemmodels/qfilesystemmodel.cpp @@ -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