summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-03 15:46:53 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-07-04 11:39:47 +0200
commit2484ecd59ca48e540205ecbdd701cefa49f597b1 (patch)
treef55cd69f7f6dd9bd2ea4a7586811f2f411fa9d4a /src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
parentc6b4470df275bd4fc39173a44c818867e03df1c7 (diff)
Replace some Q_FOREACH loops by consume loops
These loops consume their input container, so make it explicit by using qExchange(). This also means we dodge the potential issue of container modification under iteration. Change-Id: Ifc18f3d77b171e8f8e80f7c7c2db1b6ecf25f461 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp')
-rw-r--r--src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
index b8ca6f3..a1c8916 100644
--- a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
+++ b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
@@ -570,7 +570,7 @@ void QAbstractItemModelReplicaImplementation::fetchPendingData()
std::vector<RequestedData> finalRequests;
RequestedData curData;
- Q_FOREACH (const RequestedData &data, m_requestedData) {
+ for (const RequestedData &data : qExchange(m_requestedData, {})) {
qCDebug(QT_REMOTEOBJECT_MODELS) << Q_FUNC_INFO << "REQUESTED start=" << data.start << "end=" << data.end << "roles=" << data.roles;
Q_ASSERT(!data.start.isEmpty());
@@ -644,7 +644,6 @@ void QAbstractItemModelReplicaImplementation::fetchPendingData()
m_pendingRequests.push_back(watcher);
connect(watcher, &RowWatcher::finished, this, &QAbstractItemModelReplicaImplementation::requestedData);
}
- m_requestedData.clear();
}
void QAbstractItemModelReplicaImplementation::onModelReset()