seatop_move_tiling: fix stack overflow when dropping container into itself

This change avoids a cyclic reference in the window tree when dragging a
container and dropping it into one of its descendants.

The drop target resolution logic previously only checked if the target node
was the container itself, but missed checking if the target was a descendant
of the dragged container.

Fixes: #7949
This commit is contained in:
Scott Leggett 2026-05-22 23:03:31 +08:00
parent 9c663b1fa1
commit d563eb1455
No known key found for this signature in database

View file

@ -252,8 +252,9 @@ static void handle_motion_postthreshold(struct sway_seat *seat) {
}
if (edge) {
e->target_node = node_get_parent(&con->node);
if (e->target_node == &e->con->node) {
e->target_node = node_get_parent(e->target_node);
if (e->target_node && (e->target_node == &e->con->node ||
node_has_ancestor(e->target_node, &e->con->node))) {
e->target_node = node_get_parent(&e->con->node);
}
e->target_edge = edge;
update_indicator(e, &box);