Use some qExchange()
This makes the code more compact and avoids any doubts regarding accesses to the underlying container under iteration, if any. Change-Id: I6cf8a6113f182ae5c4401cb44fce2a3904c67489 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
bbf8fc2222
commit
0f80177d98
@ -167,13 +167,11 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
|||||||
if (mSyncCallback)
|
if (mSyncCallback)
|
||||||
wl_callback_destroy(mSyncCallback);
|
wl_callback_destroy(mSyncCallback);
|
||||||
|
|
||||||
qDeleteAll(mInputDevices);
|
qDeleteAll(qExchange(mInputDevices, {}));
|
||||||
mInputDevices.clear();
|
|
||||||
|
|
||||||
foreach (QWaylandScreen *screen, mScreens) {
|
for (QWaylandScreen *screen : qExchange(mScreens, {})) {
|
||||||
QWindowSystemInterface::handleScreenRemoved(screen);
|
QWindowSystemInterface::handleScreenRemoved(screen);
|
||||||
}
|
}
|
||||||
mScreens.clear();
|
|
||||||
qDeleteAll(mWaitingScreens);
|
qDeleteAll(mWaitingScreens);
|
||||||
|
|
||||||
#if QT_CONFIG(wayland_datadevice)
|
#if QT_CONFIG(wayland_datadevice)
|
||||||
|
@ -149,11 +149,10 @@ void Surface::surface_commit(Resource *resource)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (wl_resource *frameCallback, m_frameCallbackList) {
|
for (wl_resource *frameCallback : qExchange(m_frameCallbackList, {})) {
|
||||||
wl_callback_send_done(frameCallback, m_compositor->time());
|
wl_callback_send_done(frameCallback, m_compositor->time());
|
||||||
wl_resource_destroy(frameCallback);
|
wl_resource_destroy(frameCallback);
|
||||||
}
|
}
|
||||||
m_frameCallbackList.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user