diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-04 07:39:32 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-04 07:39:32 +0000 |
commit | a526e3fe0251880978baee867f72d59de4b3e84e (patch) | |
tree | f47e9ce8f0c67d0fde2a89046f60ebd0afc5d3dc /gc.c | |
parent | 96f82b243fce324b33e71357564a15b51f6aa949 (diff) |
* object.c (copy_object): copy finalizers as well if any.
* gc.c (rb_gc_copy_finalizer): new function to copy finalizers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1475,6 +1475,22 @@ define_final(argc, argv, os) return proc; } +void +rb_gc_copy_finalizer(dest, obj) + VALUE dest, obj; +{ + VALUE table; + + if (!finalizer_table) return; + if (!FL_TEST(obj, FL_FINALIZE)) return; + if (FL_TEST(dest, FL_FINALIZE)) { + rb_warn("copy_finalizer: descarding old finalizers"); + } + if (st_lookup(finalizer_table, obj, &table)) { + st_insert(finalizer_table, dest, table); + } +} + static VALUE run_single_final(args) VALUE *args; |