aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/xwayland
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-10-14 00:24:32 +0100
committerVaxry <[email protected]>2024-10-14 00:24:32 +0100
commitabfd550ee228ea23058039790e792b45d2467c8d (patch)
treec8710c5d7f5acd870f8298d72c6fab8a00d45eca /src/xwayland
parent8e51a36c7fd500e865e34f08ab4dc4331dca59cf (diff)
downloadHyprland-abfd550ee228ea23058039790e792b45d2467c8d.tar.gz
Hyprland-abfd550ee228ea23058039790e792b45d2467c8d.zip
xwm: avoid infinite parent lookup loop in lookupParentExists
ref #8045
Diffstat (limited to 'src/xwayland')
-rw-r--r--src/xwayland/XWM.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index dcb22eae..248813bf 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -150,10 +150,17 @@ void CXWM::handleUnmapNotify(xcb_unmap_notify_event_t* e) {
}
static bool lookupParentExists(SP<CXWaylandSurface> XSURF, SP<CXWaylandSurface> prospectiveChild) {
+ std::vector<SP<CXWaylandSurface>> visited;
+
while (XSURF->parent) {
if (XSURF->parent == prospectiveChild)
return true;
+ visited.emplace_back(XSURF);
+
XSURF = XSURF->parent.lock();
+
+ if (std::find(visited.begin(), visited.end(), XSURF) != visited.end())
+ return false;
}
return false;