From ab33a83d545205e5319c6bd32d678d7f07b0f4fb Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 10 Sep 2010 09:25:32 +0000 Subject: [PATCH] fix buggy use of forwarding caallback git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@31290 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ sendmsg.c | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 473149b..1fdf91a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-09-10 Richard Frith-Macdonald + + * sendmsg.c: (get_imp) ... fix call to __objc_get_forward_imp to + pass nil as the receiver since we don't know the receiver at this + point. Passing the class is often wrong and can result in us calling + a class method when we want an instance method of the same name. + 2010-05-12 Adam Fedor * Version 1.7.0 Snapshot release diff --git a/sendmsg.c b/sendmsg.c index 5df8e19..ca67379 100644 --- a/sendmsg.c +++ b/sendmsg.c @@ -178,8 +178,11 @@ get_imp (Class class, SEL sel) /* The dispatch table has been installed, and the method is not in the dispatch table. So the method just doesn't exist for the class. Return the forwarding - implementation. */ - res = __objc_get_forward_imp ((id)class, sel); + implementation. + We don't know the receiver (only it's class), so we + can't pass that to the function :-( + */ + res = __objc_get_forward_imp (nil, sel); } } }