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

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 30 00:34:35 PDT 2008


Revision: 527
          http://trac.macosforge.org/projects/ruby/changeset/527
Author:   lsansonetti at apple.com
Date:     2008-08-30 00:34:32 -0700 (Sat, 30 Aug 2008)
Log Message:
-----------
always return NULL in the kvo setter

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

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2008-08-30 06:58:37 UTC (rev 526)
+++ MacRuby/trunk/objc.m	2008-08-30 07:34:32 UTC (rev 527)
@@ -1245,6 +1245,7 @@
 
     if (ffi_rettype != &ffi_type_void) {
 	ffi_ret = (void *)alloca(ffi_rettype->size);
+	memset(ffi_ret, 0, ffi_rettype->size);
     }
     else {
 	ffi_ret = NULL;
@@ -2777,7 +2778,7 @@
     }
 }
 
-static void
+static void *
 rb_objc_kvo_setter_imp(void *recv, SEL sel, void *value)
 {
     const char *selname;
@@ -2791,6 +2792,8 @@
     buf[s + 1] = '\0';
 
     rb_ivar_set((VALUE)recv, rb_intern(buf), value == NULL ? Qnil : OC2RB(value));
+
+    return NULL; /* we explicitely return NULL because otherwise a special constant may stay on the stack and be returned to Objective-C, and do some very nasty crap, especially if called via -[performSelector:]. */
 }
 
 void
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080830/f8ce04ef/attachment.html 


More information about the macruby-changes mailing list