[macruby-changes] [946] MacRuby/branches/experimental/roxor.cpp

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 16 16:55:16 PDT 2009


Revision: 946
          http://trac.macosforge.org/projects/ruby/changeset/946
Author:   lsansonetti at apple.com
Date:     2009-03-16 16:55:16 -0700 (Mon, 16 Mar 2009)
Log Message:
-----------
do not leak the exception object + fixed a bug when returning the special constants dollar-sign1-9

Modified Paths:
--------------
    MacRuby/branches/experimental/roxor.cpp

Modified: MacRuby/branches/experimental/roxor.cpp
===================================================================
--- MacRuby/branches/experimental/roxor.cpp	2009-03-16 23:54:25 UTC (rev 945)
+++ MacRuby/branches/experimental/roxor.cpp	2009-03-16 23:55:16 UTC (rev 946)
@@ -4348,7 +4348,7 @@
     abort(); // never reached
 }
 
-static inline VALUE
+static VALUE
 method_missing(VALUE obj, SEL sel, int argc, const VALUE *argv, int call_status)
 {
     GET_VM()->method_missing_reason = call_status;
@@ -4369,7 +4369,7 @@
 	buf[n - 1] = '\0';
     }
     new_argv[0] = ID2SYM(rb_intern(buf));
-    MEMCPY(new_argv + 1, argv, VALUE, argc);
+    MEMCPY(&new_argv[1], argv, VALUE, argc);
 
     return rb_vm_call(obj, selMethodMissing, argc + 1, new_argv, false);
 }
@@ -4960,7 +4960,7 @@
 	    {
 		int index = (int)code;
 		assert(index > 0 && index < 10);
-		val = rb_reg_nth_match(index, backref);
+		val = rb_reg_nth_match(index - 1, backref);
 	    }
 	    break;
     }
@@ -4996,6 +4996,9 @@
 void
 rb_vm_raise(VALUE exception)
 {
+    VALUE current_exception = GET_VM()->current_exception;
+    assert(current_exception == Qnil);
+    rb_objc_retain((void *)exception);
     GET_VM()->current_exception = exception;
     void *exc = __cxa_allocate_exception(0);
     __cxa_throw(exc, NULL, NULL);
@@ -5079,6 +5082,7 @@
 {
     VALUE exc = GET_VM()->current_exception;
     assert(exc != Qnil);
+    rb_objc_release((void *)exc);
     GET_VM()->current_exception = Qnil;
     return exc; 
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090316/55f406bf/attachment.html>


More information about the macruby-changes mailing list