On 20 May 2011, at 17:03, Stefan Bidi wrote: > Earlier today I committed the first set of changes to CFString. It now uses > libicu instead of NSString. This will allow a lot of extra functionality to > work, include any of the functions that use CFLocale. Anyway, that's just > the background. > > In order to make this work, I moved __CFStringMakeConstantString() to > CFString.c and changed it to use CFDictionary instead of NSSet (CFSet doesn't > yet exist). When I did that, I started getting an exception whenever trying > to add anything to the dictionary (CFString.c:1173). It took me a while to > figure it out, and it is due to GSDictionary setting GSI_MAP_RETAIN_KEY() > being set to call -copyWithZone:. For some reason, whenever that happens I > get a NSCFType does not recognize -copyWithZone: exception. > > I don't understand enough about how GSDictionary works, so I was wondering if > anyone could help me out here? Really, I don't even understand why > -copyWithZone: is being called since I just need to object retained, not > copied.
What's being copied is a dictionary key. Dictionary keys are (and must be) always copied as they need to be immutable objects. Strictly speaking all that's really needed technically is that the objects must not be mutated (changing their -hash and/or -isEqual:) while they are acting as dictionary keys, but the API documentation explicitly states that they are copied anyway. Anyway, your immutable string objects should increment their retain count and return themselves when copied, and your mutable string objects should implement the copy to return an immutable version. _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
