diff --git a/ChangeLog b/ChangeLog index d7b57583c..72b6e6265 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-07 Richard Frith-Macdonald + + * Source/GSFFIInvocation.m: Fix breakage caused by David's changes. + * Source/ObjectiveC2/runtime.m: Fix handling of nul arguments in + class_sespondsToSelector(). + 2010-06-05 Richard Frith-Macdonald * Tools/Makefile.postamble: Fix breakage of instalation of gdomap diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m index 86cbdb2b1..dfcb05106 100644 --- a/Source/GSFFIInvocation.m +++ b/Source/GSFFIInvocation.m @@ -22,8 +22,6 @@ Boston, MA 02111 USA. */ -#define class_pointer isa - #import "common.h" #define EXPOSE_NSInvocation_IVARS 1 #import "Foundation/NSException.h" @@ -147,21 +145,18 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel) ffi_closure *cclosure; NSMethodSignature *sig; GSCodeBuffer *memory; + Class c; - if (class_respondsToSelector(receiver->isa, sel) || - (class_respondsToSelector(receiver->isa, @selector(respondsToSelector:)) - && [receiver respondsToSelector: sel])) + c = object_getClass(receiver); + if (class_respondsToSelector(c, sel) + || (class_respondsToSelector(c, @selector(respondsToSelector:)) + && [receiver respondsToSelector: sel])) { sig = [receiver methodSignatureForSelector: sel]; } else { - [NSException raise: NSInvalidArgumentException - format: @"GSFFIInvocation: Class '%s'(%s) does not respond" - @" to forwardInvocation: for '%s'", - GSClassNameFromObject(receiver), - GSObjCIsInstance(receiver) ? "instance" : "class", - sel ? sel_getName(sel) : "(null)"]; + sig = nil; } if (sig == nil) diff --git a/Source/ObjectiveC2/runtime.c b/Source/ObjectiveC2/runtime.c index 028737e68..488d69e42 100644 --- a/Source/ObjectiveC2/runtime.c +++ b/Source/ObjectiveC2/runtime.c @@ -518,7 +518,9 @@ class_replaceMethod(Class cls, SEL name, IMP imp, const char *types) BOOL class_respondsToSelector(Class cls, SEL sel) { - return __objc_responds_to((id) & cls, sel); + if (cls != 0 && sel != 0 && __objc_responds_to((id) & cls, sel) != 0) + return YES; + return NO; } void