diff options
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/variable.c b/variable.c index 0b2c8ebe07..c37548fb91 100644 --- a/variable.c +++ b/variable.c @@ -924,7 +924,15 @@ rb_copy_generic_ivar(clone, obj) if (!generic_iv_tbl) return; if (st_lookup(generic_iv_tbl, obj, &tbl)) { - st_add_direct(generic_iv_tbl, clone, st_copy(tbl)); + st_table *old; + + if (st_lookup(generic_iv_tbl, clone, &old)) { + st_free_table(old); + st_insert(generic_iv_tbl, clone, st_copy(tbl)); + } + else { + st_add_direct(generic_iv_tbl, clone, st_copy(tbl)); + } } } |