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

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 21 19:34:12 PST 2010


Revision: 5065
          http://trac.macosforge.org/projects/ruby/changeset/5065
Author:   lsansonetti at apple.com
Date:     2010-12-21 19:34:08 -0800 (Tue, 21 Dec 2010)
Log Message:
-----------
fix a bug when we would free outer memory but still keep outers pointing to that memory location, causing crashes later during const lookup (this fixes rspec)

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

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2010-12-22 00:33:30 UTC (rev 5064)
+++ MacRuby/trunk/vm.cpp	2010-12-22 03:34:08 UTC (rev 5065)
@@ -1279,17 +1279,16 @@
 	struct rb_vm_outer *mod_outer = get_outer(mod);
 	struct rb_vm_outer *class_outer = get_outer(klass);
 	if (class_outer == NULL || class_outer->outer != mod_outer) {
-	    if (class_outer != NULL) {
-		free(class_outer);
+	    if (class_outer == NULL) {
+		class_outer = (struct rb_vm_outer *)
+		    malloc(sizeof(struct rb_vm_outer));
+		class_outer->klass = klass;
 	    }
-	    class_outer = (struct rb_vm_outer *)
-		malloc(sizeof(struct rb_vm_outer));
-	    class_outer->klass = klass;
 	    class_outer->outer = mod_outer;
 	    outers[klass] = class_outer;
 #if ROXOR_VM_DEBUG
-	    printf("set outer of %s to %s\n", class_getName(klass),
-		    class_getName(mod));
+	    printf("set outer of %s to %s (%p)\n", class_getName(klass),
+		    class_getName(mod), mod_outer);
 #endif
 	}
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101221/faef398d/attachment.html>


More information about the macruby-changes mailing list