Revision
3914
Author
lsansonetti@apple.com
Date
2010-04-07 00:34:31 -0700 (Wed, 07 Apr 2010)

Log Message

fix a bug in Module#initialize which could be re-entered upon +initialize

Modified Paths

Diff

Modified: MacRuby/trunk/object.c (3913 => 3914)


--- MacRuby/trunk/object.c	2010-04-07 07:33:50 UTC (rev 3913)
+++ MacRuby/trunk/object.c	2010-04-07 07:34:31 UTC (rev 3914)
@@ -1840,8 +1840,16 @@
 VALUE
 rb_mod_initialize(VALUE module, SEL sel)
 {
-    if (rb_block_given_p()) {
-	rb_mod_module_exec(module, 0, 1, &module);
+    static bool initialized = false;
+    if (!initialized) {
+	initialized = true;
+	// force initialize
+	class_getMethodImplementation((Class)module, sel);
+	initialized = false;
+
+	if (rb_block_given_p()) {
+	    rb_mod_module_exec(module, 0, 1, &module);
+	}
     }
     return Qnil;
 }