[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sr #107515] Objective-C forwarding not working with libffi library
From: |
Jonathan Olson |
Subject: |
[sr #107515] Objective-C forwarding not working with libffi library |
Date: |
Sat, 13 Nov 2010 16:17:04 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 |
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/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [sr #107515] Objective-C forwarding not working with libffi library,
Jonathan Olson <=