URL:
<http://savannah.gnu.org/support/?107515>
Summary: Objective-C forwarding not working with libffi
library
Project: GNUstep
Submitted by: jpolsonaz
Submitted on: Sat 13 Nov 2010 04:17:03 PM GMT
Category: Foundation
Priority: 5 - Normal
Severity: 4 - Important
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Details:
I recently encountered a serious bug in gnustep-base-1.20.1 when building
using libffi. This bug would affect any application which proxies methods
using methodSignatureForSelector: and forwardInvocation:
When libffi is used for message forwarding, an object's
methodSignatureForSelector: instance method is never invoked if the caller
invokes the proxy using a call like the following:
[proxy performSelector:aSelector withObject:anObject]
This is because the implementation of [NSObject performSelector:withObject:]
uses the following call to lookup the IMP for the specified selector.
return get_imp(object_getClass(self), aSelector);
Note that because get_imp() only looks up methods in the object's class, it
cannot possibly invoke methodSignatureForSelector: for the instance to
determine the correct method signature for forwarded methods.
This bug only affects libffi, because FFI forwarding requires a correct
signature to create a valid IMP to return as a trampoline. In contrast, the
ffcall interface invokes methodSignatureForSelector: later in the call to the
function returned by get_imp().
Attached is a patch which resolves this problem for gnustep-base-1.20.1.
This patch replaces the calls to get_imp() with objc_msg_lookup() which
correctly handles message forwarding.
Regards,
Jonathan P. Olson
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sat 13 Nov 2010 04:17:03 PM GMT Name: nsobject.patch Size: 1kB By:
jpolsonaz
<http://savannah.gnu.org/support/download.php?file_id=22002>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/support/?107515>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep