From d7ea1b7785f31e9fd6477490309721a19a835592 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Mon, 1 Jul 2024 00:26:08 +0200 Subject: [PATCH] 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. --- src/desktop/Window.cpp | 6 ++++-- 1 file 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; }