From 1fdbe0f437de59f87527818918b55d794a5fb92d Mon Sep 17 00:00:00 2001 From: nagachika Date: Thu, 9 Jun 2011 14:45:56 +0000 Subject: * gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for type check to get rid of a double free when main Thread has singleton class. [ruby-core:36741] [Bug #4828] * thread.c (rb_obj_is_mutex): add a new utility function. * vm.c (rb_obj_is_thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 28fa233adc..aab0963c29 100644 --- a/gc.c +++ b/gc.c @@ -3005,7 +3005,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace) while (p < pend) { if (BUILTIN_TYPE(p) == T_DATA && DATA_PTR(p) && RANY(p)->as.data.dfree && - RANY(p)->as.basic.klass != rb_cThread && RANY(p)->as.basic.klass != rb_cMutex) { + !rb_obj_is_thread((VALUE)p) && !rb_obj_is_mutex((VALUE)p) ) { p->as.free.flags = 0; if (RTYPEDDATA_P(p)) { RDATA(p)->dfree = RANY(p)->as.typeddata.type->function.dfree; -- cgit v1.2.3