bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #36706] performSelector: not working with message fowarding


From: Michael Johnston
Subject: [bug #36706] performSelector: not working with message fowarding
Date: Fri, 22 Jun 2012 15:28:48 +0000
User-agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/11.04 Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19

URL:
  <http://savannah.gnu.org/bugs/?36706>

                 Summary: performSelector: not working with message fowarding
                 Project: GNUstep
            Submitted by: mjohnston
            Submitted on: Fri 22 Jun 2012 03:28:47 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I've seem this problem in base-1.22,1.24
Regression: Same code was working in base-1.21

I have code which calls [object performSelector:sel] where sel is not
implemented by object (and object is an instance not a class)

In the 1.21 runtime this worked fine.
Now this raises an NSInvalidArgumentException saying:

"+[class methodName] unrecognized selector sent to instance ..."

Note it is saying the class doesn't respond to the method - which is correct
as its the instance which has the fowarding implemented - but why is it
sending methodName to class?

>From gdb what happens is 

- performSelector calls class_getMethodImplementation passing the class and
selector. 
>From the docs this should return the pointer that would be called if a
particular message were sent to an instance of a class.

- class_getMethodImplementation calls get_imp. Not sure what happens in here
but I assume the imp isn't found and hence the message forwarding mechanism is
entered

- get_imp calls gs_objc_msg_foward2 in GSFFIInvocation.m - passing the class
(as the receiver parameter) and the selector

- gs_objc_msg_forward2 calls (line 185)
             sig = [receiver methodSignatureForSelector: sel];

Which returns nil as receiver is the class not the instance. 
This causes the exception to be raised a couple of lines later.

Not sure if the problem lies with get_imp calling gs_objc_msg_foward2 with a
class (which doesn't seem to make sense), or if class_getMethodImplementation
can be expected to forward a message at all.

Any help with above appreciated.











    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36706>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]