Revision
527
Author
lsansonetti@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

Diff

Modified: MacRuby/trunk/objc.m (526 => 527)


--- 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