diff --git a/ChangeLog b/ChangeLog index 5d19e8a3e4..4d52135bff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Feb 11 18:09:41 2009 NAKAMURA Usaku + + * gc.c (define_final, undefine_final): shouldn't add/remove finalizer + of forzen objects. + + * gc.c (undefine_final): should remove FL_FINALIZE flag. + [ruby-dev:37964] (also see [ruby-dev:37959]) + Wed Feb 11 17:37:41 2009 Tanaka Akira * ext/socket/lib/socket.rb (Socket.udp_server_sockets): call the block diff --git a/gc.c b/gc.c index 784949cf9e..998772d150 100644 --- a/gc.c +++ b/gc.c @@ -2261,9 +2261,11 @@ static VALUE undefine_final(VALUE os, VALUE obj) { rb_objspace_t *objspace = &rb_objspace; + if (OBJ_FROZEN(obj)) rb_error_frozen("object"); if (finalizer_table) { st_delete(finalizer_table, (st_data_t*)&obj, 0); } + FL_UNSET(obj, FL_FINALIZE); return obj; } @@ -2283,6 +2285,7 @@ define_final(int argc, VALUE *argv, VALUE os) VALUE obj, block, table; rb_scan_args(argc, argv, "11", &obj, &block); + if (OBJ_FROZEN(obj)) rb_error_frozen("object"); if (argc == 1) { block = rb_block_proc(); }