Hi again,
I was investigating what approach Apple took in solving a problem with
calling CF functions on ObjC objects, which return an autoreleased
object in ObjC, but clearly shouldn't do so when using the CF call.
For instance, you have to release the result of
CFTimeZoneCopyLocalizedName() yourself, but you mustn't do that with
[NSTimeZone localizedName:locale:], since that will be autoreleased.
An ordinary CF_OBJC_FUNCDISPATCH from the former to the latter therefore
doesn't work correctly "out of box". Apple's source code showed no
solution at all, but still on OS X it seemed to work correctly...
So I took my disassembler again and voilá! The source code released by
Apple under the 10.8 section *doesn't match* the OS X 10.8 binares. In
CFTimeZone's case it doesn't match it at all.
CFTimeZone on OS X is *entirely* built on top of NSTimeZone.
CFTimeZoneCopyLocalizedName() actually does something like this:
=====
_CFAutoreleasePoolPush();
NSString* retval = [(NSTimeZone*)tzSelf localizedName: arg1
locale: arg2];
CFRetain(retval);
_CFAutoreleasePoolPop();
return retval;
=====
Which explains why it doesn't exhibit the above described problem as one
would expect from their source code.
So Chan, you were partially right. But I've checked other types and it
seems it is the case only in CFTimeZone.
--
Luboš Doležel
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev