summaryrefslogtreecommitdiff
path: root/src/desktop/Window.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-07-01 00:26:08 +0200
committerGitHub <noreply@github.com>2024-07-01 00:26:08 +0200
commitd7ea1b7785f31e9fd6477490309721a19a835592 (patch)
tree888c738c1c32afb7e4e0b0345f5cac455d8dd229 /src/desktop/Window.cpp
parent4d6f96f74f9fa6e7b69790fa569ffe60267f8017 (diff)
xwayland: break cyclic loop of parents (#6722)
in X11 some surfaces is a parent of itself and creates a cyclic loop when trying to find its parent. check for old parent and break if its beginning to roll over.
Diffstat (limited to 'src/desktop/Window.cpp')
-rw-r--r--src/desktop/Window.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index e67a3357..560e5103 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -444,9 +444,11 @@ PHLWINDOW CWindow::X11TransientFor() {
if (!m_pXWaylandSurface || !m_pXWaylandSurface->parent)
return nullptr;
- auto s = m_pXWaylandSurface->parent;
+ auto s = m_pXWaylandSurface->parent;
+ auto oldParent = s;
while (s) {
- if (!s->parent)
+ // break cyclic loop of m_pXWaylandSurface being parent of itself, #TODO reject this from even being created?
+ if (!s->parent || s->parent == oldParent)
break;
s = s->parent;
}