mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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.
This commit is contained in:
parent
1de0b28cbb
commit
5dfd86cf3f
1 changed files with 2 additions and 2 deletions
4
shape.c
4
shape.c
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue