summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-01-13 14:04:20 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-01-30 10:27:12 +0100
commit0088b09e79da01534a703f69dbccbd721e7594d8 (patch)
tree7051f924a9a7e18bfa8f9ee4e044e2629acd6f76 /src
parentdb4afd9caf037cfff7aca8b130d326c340b7fed0 (diff)
downloadqtwayland-0088b09e79da01534a703f69dbccbd721e7594d8.tar.gz
compositor: Fix crash when raising shell surface item
This was introduced by d89c8920f3b82dd2098971b5a66c4b9c75da5af0. The raise() function would search for a suitable surface, but failing to find one, it would search past the end of the childItems list and cause memory corruption. [ChangeLog][QtWaylandCompositor] Fixed an issue where the compositor would sometimes crash if a shell surface item was brought to front. Pick-to: 6.4 6.5 Fixes: QTBUG-109051 Change-Id: I2249f0881b90fc05b5f0292cd35c6524db4663c5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
index 28806f62..dfbe4149 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -319,11 +319,14 @@ void QWaylandQuickShellSurfaceItemPrivate::raise()
return (!staysOnTop && surf->staysOnTop()) || (staysOnBottom && !surf->staysOnBottom());
return true; // ignore any other Quick items that may be there
};
- while (skip(*it))
+ auto end = parent->childItems().crend();
+ while (it != end && skip(*it))
++it;
- QQuickItem *top = *it;
- if (moveItem != top)
- moveItem->stackAfter(top);
+ if (it != end) {
+ QQuickItem *top = *it;
+ if (moveItem != top)
+ moveItem->stackAfter(top);
+ }
}
/*