mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2025-02-18 02:52:07 +01:00
scene: ensure node cannot be reparented below itself
This commit is contained in:
parent
a1d462fa81
commit
0f534e32e4
1 changed files with 7 additions and 0 deletions
|
@ -138,6 +138,13 @@ void wlr_scene_node_reparent(struct wlr_scene_node *node,
|
||||||
if (node->parent == new_parent) {
|
if (node->parent == new_parent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* Ensure that a node cannot become its own ancestor */
|
||||||
|
for (struct wlr_scene_node *ancestor = new_parent; ancestor != NULL;
|
||||||
|
ancestor = ancestor->parent) {
|
||||||
|
if (ancestor == node) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wl_list_remove(&node->state.link);
|
wl_list_remove(&node->state.link);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue