diff options
author | Isaac Freund <[email protected]> | 2021-10-13 16:00:53 +0200 |
---|---|---|
committer | Simon Ser <[email protected]> | 2021-10-14 21:10:03 +0200 |
commit | a4ea63f084e292e7bca884605fb0607ffd9b454f (patch) | |
tree | a6aed0296247adf09fb57905344adfa325401d86 | |
parent | 226c87b894a41fcee38e61257bc97e4c021c9a5b (diff) |
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.
-rw-r--r-- | wlr_scene.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) { |