summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-06-12 11:57:56 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-06-12 11:58:07 +0200
commitf51f83adbc2d687cd624a6f69ed4e7d6ff506291 (patch)
tree22250dac89e2fc5a1460decc1d409f2c33bb33d2
parentdef0e4145f1d329679a8c603405bd0e96f2d9484 (diff)
Compositor: Fix crash when destroying QWaylandSurfaces with multiple views
This was a regression when we switched from foreach to range-based for. QWaylandViewPrivate::markSurfaceAsDestroyed causes QWaylandSurfacePrivate::views to mutate. Change-Id: I38881998a5480b84387062cd70ae5ec321320a24 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index add4020da..433b53228 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -151,7 +151,8 @@ void QWaylandSurfacePrivate::removeFrameCallback(QtWayland::FrameCallback *callb
void QWaylandSurfacePrivate::notifyViewsAboutDestruction()
{
Q_Q(QWaylandSurface);
- for (QWaylandView *view : qAsConst(views)) {
+ const auto viewsCopy = views; // Views will be removed from the list when marked as destroyed
+ for (QWaylandView *view : viewsCopy) {
QWaylandViewPrivate::get(view)->markSurfaceAsDestroyed(q);
}
if (hasContent) {