[macruby-changes] [3914] MacRuby/trunk/object.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 7 00:34:32 PDT 2010


Revision: 3914
          http://trac.macosforge.org/projects/ruby/changeset/3914
Author:   lsansonetti at 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:
--------------
    MacRuby/trunk/object.c

Modified: MacRuby/trunk/object.c
===================================================================
--- 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;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100407/0596f6ea/attachment-0001.html>


More information about the macruby-changes mailing list