From a4ea63f084e292e7bca884605fb0607ffd9b454f Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Wed, 13 Oct 2021 16:00:53 +0200 Subject: scene: assert that node != sibling in place above/below Currently these functions remove the node from the scene if the sibling argument is the same node as the node. To prevent confusion when misusing this API, assert that the nodes are distinct and document this. --- wlr_scene.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wlr_scene.c b/wlr_scene.c index 9ba283e..2dc2924 100644 --- a/wlr_scene.c +++ b/wlr_scene.c @@ -440,6 +440,7 @@ void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y) { void wlr_scene_node_place_above(struct wlr_scene_node *node, struct wlr_scene_node *sibling) { + assert(node != sibling); assert(node->parent == sibling->parent); if (node->state.link.prev == &sibling->state.link) { @@ -455,6 +456,7 @@ void wlr_scene_node_place_above(struct wlr_scene_node *node, void wlr_scene_node_place_below(struct wlr_scene_node *node, struct wlr_scene_node *sibling) { + assert(node != sibling); assert(node->parent == sibling->parent); if (node->state.link.next == &sibling->state.link) { -- cgit v1.2.3