[macruby-changes] [5234] MacRuby/trunk/dispatcher.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Fri Feb 18 15:15:30 PST 2011
Revision: 5234
http://trac.macosforge.org/projects/ruby/changeset/5234
Author: lsansonetti at apple.com
Date: 2011-02-18 15:15:30 -0800 (Fri, 18 Feb 2011)
Log Message:
-----------
fix a race condition bug when dispatching and resolving a method at the same time
Modified Paths:
--------------
MacRuby/trunk/dispatcher.cpp
Modified: MacRuby/trunk/dispatcher.cpp
===================================================================
--- MacRuby/trunk/dispatcher.cpp 2011-02-18 23:14:44 UTC (rev 5233)
+++ MacRuby/trunk/dispatcher.cpp 2011-02-18 23:15:30 UTC (rev 5234)
@@ -673,13 +673,26 @@
// Does the receiver implements -forwardInvocation:?
if ((opt & DISPATCH_SUPER) == 0
&& rb_objc_supports_forwarding(self, sel)) {
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+ // In earlier versions of the Objective-C runtime, there seems
+ // to be a bug where class_getInstanceMethod isn't atomic,
+ // and might return NULL while at the exact same time another
+ // thread registers the related method.
+ // As a work-around, we double-check if the method still does
+ // not exist here. If he does, we can dispatch it properly.
+ method = class_getInstanceMethod(klass, sel);
+ if (method != NULL) {
+ goto recache2;
+ }
+#endif
fill_ocache(cache, self, klass, (IMP)objc_msgSend, sel, NULL,
argc);
goto dispatch;
}
// Let's see if are not trying to call a Ruby method that accepts
- // a regular argument then a optional Hash argument, to be
+ // a regular argument then an optional Hash argument, to be
// compatible with the Ruby specification.
const char *selname = (const char *)sel;
size_t selname_len = strlen(selname);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110218/f9f82710/attachment.html>
More information about the macruby-changes
mailing list