[macruby-changes] [3178] MacRuby/trunk/vm.cpp

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 30 21:29:48 PST 2009


Revision: 3178
          http://trac.macosforge.org/projects/ruby/changeset/3178
Author:   lsansonetti at apple.com
Date:     2009-12-30 21:29:46 -0800 (Wed, 30 Dec 2009)
Log Message:
-----------
fixed a thread-safety bug in RoxorCore::retype_method()

Modified Paths:
--------------
    MacRuby/trunk/vm.cpp

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2009-12-29 03:10:07 UTC (rev 3177)
+++ MacRuby/trunk/vm.cpp	2009-12-31 05:29:46 UTC (rev 3178)
@@ -1778,6 +1778,8 @@
 RoxorCore::retype_method(Class klass, rb_vm_method_node_t *node,
 	const char *types)
 {
+    lock();
+
     // TODO: 1) don't reinstall method in case the types didn't change
     // 2) free LLVM machine code from old objc IMP
 
@@ -1788,8 +1790,12 @@
     objc_to_ruby_stubs[node->ruby_imp] = node->objc_imp;
 
     // Re-add the method.
-    return add_method(klass, node->sel, node->objc_imp, node->ruby_imp,
+    node = add_method(klass, node->sel, node->objc_imp, node->ruby_imp,
 	    node->arity, node->flags, types);
+
+    unlock();
+
+    return node;
 }
 
 rb_vm_method_node_t *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091230/827ea7c6/attachment.html>


More information about the macruby-changes mailing list