In libobjc/: 2010-11-23 Richard Frith-Macdonald <rfm@gnu.org>
authorRichard Frith-Macdonald <rfm@gnu.org>
Tue, 23 Nov 2010 19:20:54 +0000 (19:20 +0000)
committerNicola Pero <nicola@gcc.gnu.org>
Tue, 23 Nov 2010 19:20:54 +0000 (19:20 +0000)
In libobjc/:
2010-11-23  Richard Frith-Macdonald <rfm@gnu.org>

* sendmsg.c (get_imp): Fixed call to __objc_get_forward_imp to
pass nil as the receiver since we don't know the receiver at this
point.

From-SVN: r167092

libobjc/ChangeLog
libobjc/sendmsg.c

index 02be0ebd0e82d7cc799ba8e4a9f587a7c3ce9b82..08e74a8405edeaa4ea16f4117c53f340da751191 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-23  Richard Frith-Macdonald <rfm@gnu.org>
+
+       * sendmsg.c (get_imp): Fixed call to __objc_get_forward_imp to
+       pass nil as the receiver since we don't know the receiver at this
+       point.
+       
 2010-11-18  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * ivars.c: Include stdlib.h.
index ee1f0a36150c6ae0de0987291f02a994bd31cc6d..7f7024c275af1f6f3115b43bcfed8546472b4c6e 100644 (file)
@@ -189,8 +189,13 @@ 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 its
+                class), so we have to pass 'nil' as the first
+                argument.  Passing the class as first argument is
+                wrong because the class is not the receiver; it can
+                result in us calling a class method when we want an
+                instance method of the same name.  */
+             res = __objc_get_forward_imp (nil, sel);
            }
        }
     }