summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Samir <[email protected]>2024-01-04 20:18:15 +0200
committerAhmad Samir <[email protected]>2024-01-09 01:43:17 +0200
commit84588c072159d89ca937a3024c5ee5d76ff8de82 (patch)
treecfe97f80ae0b86dc5166c87d7a7be3dca06de400
parent0cda986eb6cdf681cb64811b416c413645cb0f3d (diff)
QFileInfoGatherer: simplify logic; use std::exchange
Change-Id: I8e3ccc5e30dd2e08b53fd5dcab66bc921de30538 Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--src/gui/itemmodels/qfileinfogatherer.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/gui/itemmodels/qfileinfogatherer.cpp b/src/gui/itemmodels/qfileinfogatherer.cpp
index 5156a3f21f9..88380c42172 100644
--- a/src/gui/itemmodels/qfileinfogatherer.cpp
+++ b/src/gui/itemmodels/qfileinfogatherer.cpp
@@ -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);