#1294: MacRuby crashes when loading files on the non-main thread ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction 0.11-blocker ------------------------------------+--------------------------------------- Comment(by watson1978@…): at least, it looks like it needs the exclusive control as following. {{{ #!diff diff --git a/vm.cpp b/vm.cpp index 6023920..df76396 100644 --- a/vm.cpp +++ b/vm.cpp @@ -795,6 +795,7 @@ extern "C" void * rb_vm_get_constant_cache(const char *name) { + RoxorCoreLock lock; return GET_CORE()->constant_cache_get(rb_intern(name)); } @@ -1543,8 +1544,10 @@ vm_alias_method(Class klass, Method method, ID name, bool noargs) SEL sel = rb_vm_id_to_sel(name, noargs ? 0 : 1); rb_vm_method_node_t *node = GET_CORE()->method_node_get(method); if (node != NULL) { + GET_CORE()->lock(); GET_CORE()->add_method(klass, sel, imp, node->ruby_imp, node->arity, node->flags, types); + GET_CORE()->unlock(); } else { class_replaceMethod(klass, sel, imp, types); @@ -2180,8 +2183,10 @@ prepare_method: imp = (IMP)data; } assert(objc_imp_types != NULL); + GET_CORE()->lock(); GET_CORE()->resolve_method(klass, sel, NULL, arity, flags, imp, m, objc_imp_types); + GET_CORE()->unlock(); } else { #if MACRUBY_STATIC }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1294#comment:14> MacRuby <http://macruby.org/>