[macruby-changes] [707] MacRuby/trunk/objc.m

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 3 00:19:40 PST 2008


Revision: 707
          http://trac.macosforge.org/projects/ruby/changeset/707
Author:   lsansonetti at apple.com
Date:     2008-11-03 00:19:40 -0800 (Mon, 03 Nov 2008)
Log Message:
-----------
fixed a bug where classes created from one BS file would be erased if re-opened in a second BS file

Modified Paths:
--------------
    MacRuby/trunk/objc.m

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2008-11-03 08:19:03 UTC (rev 706)
+++ MacRuby/trunk/objc.m	2008-11-03 08:19:40 UTC (rev 707)
@@ -1152,7 +1152,7 @@
 
     ocrcv = RB2OC(recv);
 
-    DLOG("OCALL", "%c[<%s %p> %s]", class_isMetaClass((Class)klass) ? '+' : '-', class_getName((Class)klass), (void *)ocrcv, (char *)sel);
+    DLOG("OCALL", "%c[<%s %p> %s] types=%s bs_method=%p", class_isMetaClass((Class)klass) ? '+' : '-', class_getName((Class)klass), (void *)ocrcv, (char *)sel, sig->types, bs_method);
 
     count = sig->argc;
     assert(count >= 2);
@@ -2559,24 +2559,30 @@
 	    bs_element_indexed_class_t *bs_class_new;
 	    unsigned i;
 
-	    bs_class_new = (bs_element_indexed_class_t *)
-		malloc(sizeof(bs_element_indexed_class_t));
+	    if (!st_lookup(bs_classes, (st_data_t)bs_class->name, 
+		(st_data_t *)&bs_class_new)) {
+		bs_class_new = (bs_element_indexed_class_t *)
+		    malloc(sizeof(bs_element_indexed_class_t));
 
-	    bs_class_new->name = bs_class->name;
+		bs_class_new->name = bs_class->name;
+		bs_class_new->cmethods = bs_class_new->imethods = NULL;
 
+		st_insert(bs_classes, (st_data_t)bs_class_new->name, 
+		    (st_data_t)bs_class_new);
+	    }
+
 #define INDEX_METHODS(table, ary, len) \
     do { \
 	if (len > 0) { \
-	    table = st_init_numtable(); \
-	    rb_objc_retain(table); \
+	    if (table == NULL) { \
+	        table = st_init_numtable(); \
+		rb_objc_retain(table); \
+	    } \
 	    for (i = 0; i < len; i++) { \
 		bs_element_method_t *method = &ary[i]; \
 		st_insert(table, (st_data_t)method->name, (st_data_t)method); \
 	    } \
 	} \
-	else { \
-	    table = NULL; \
-	} \
     } \
     while (0)
 
@@ -2588,9 +2594,6 @@
 
 #undef INDEX_METHODS
 
-	    st_insert(bs_classes, (st_data_t)bs_class_new->name, 
-		(st_data_t)bs_class_new);
-
 	    free(bs_class);
 	    do_not_free = true;
 	    break;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20081103/61fa70d2/attachment-0001.html>


More information about the macruby-changes mailing list