QFileInfoGatherer: simplify logic; use std::exchange
Change-Id: I8e3ccc5e30dd2e08b53fd5dcab66bc921de30538 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
0cda986eb6
commit
84588c0721
@ -263,11 +263,9 @@ void QFileInfoGatherer::setWatching(bool v)
|
|||||||
#if QT_CONFIG(filesystemwatcher)
|
#if QT_CONFIG(filesystemwatcher)
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
if (v != m_watching) {
|
if (v != m_watching) {
|
||||||
if (!v) {
|
|
||||||
delete m_watcher;
|
|
||||||
m_watcher = nullptr;
|
|
||||||
}
|
|
||||||
m_watching = v;
|
m_watching = v;
|
||||||
|
if (!m_watching)
|
||||||
|
delete std::exchange(m_watcher, nullptr);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(v);
|
Q_UNUSED(v);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user