QFileInfoGatherer: simplify logic; use std::exchange

Change-Id: I8e3ccc5e30dd2e08b53fd5dcab66bc921de30538
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Ahmad Samir 2024-01-04 20:18:15 +02:00
parent 0cda986eb6
commit 84588c0721

View File

@ -263,11 +263,9 @@ void QFileInfoGatherer::setWatching(bool v)
#if QT_CONFIG(filesystemwatcher)
QMutexLocker locker(&mutex);
if (v != m_watching) {
if (!v) {
delete m_watcher;
m_watcher = nullptr;
}
m_watching = v;
if (!m_watching)
delete std::exchange(m_watcher, nullptr);
}
#else
Q_UNUSED(v);