diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index 3b3035d066..8180183fe6 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -129,11 +129,13 @@ void wlr_scene_node_set_enabled(struct wlr_scene_node *node, bool enabled); void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y); /** * Move the node right above the specified sibling. + * Asserts that node and sibling are distinct and share the same parent. */ void wlr_scene_node_place_above(struct wlr_scene_node *node, struct wlr_scene_node *sibling); /** * Move the node right below the specified sibling. + * Asserts that node and sibling are distinct and share the same parent. */ void wlr_scene_node_place_below(struct wlr_scene_node *node, struct wlr_scene_node *sibling); diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 9ba283efac..2dc292474b 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/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) {