diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-07-07 16:17:49 -0700 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-07-09 10:38:04 -0700 |
| commit | 5dfd86cf3f35f59f551bf8636a503ae46a99e0d7 (patch) | |
| tree | d9daee60b66c48dbb46408fab022c93fca0af6d9 /shape.c | |
| parent | 1de0b28cbb6c0012f767bece5fb7b455985d1a54 (diff) | |
Fix off-by-one in shape_tree_mark/shape_tree_compact
This was using < so subtract one from the last shape id would have us
miss the last inserted shape. I think this is unlikely to have caused
issues because I don't think the newest shape will ever have edges.
We do need to use `- 1` because otherwise RSHAPE wraps around and
returns the root shape.
Diffstat (limited to 'shape.c')
| -rw-r--r-- | shape.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -300,7 +300,7 @@ shape_tree_mark(void *data) { rb_shape_t *cursor = rb_shape_get_root_shape(); rb_shape_t *end = RSHAPE(rb_shape_tree.next_shape_id - 1); - while (cursor < end) { + while (cursor <= end) { if (cursor->edges && !SINGLE_CHILD_P(cursor->edges)) { rb_gc_mark_movable(cursor->edges); } @@ -313,7 +313,7 @@ shape_tree_compact(void *data) { rb_shape_t *cursor = rb_shape_get_root_shape(); rb_shape_t *end = RSHAPE(rb_shape_tree.next_shape_id - 1); - while (cursor < end) { + while (cursor <= end) { if (cursor->edges && !SINGLE_CHILD_P(cursor->edges)) { cursor->edges = rb_gc_location(cursor->edges); } |
