[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exception when using GSDictionary in corebase
From: |
Dr. H. Nikolaus Schaller |
Subject: |
Re: Exception when using GSDictionary in corebase |
Date: |
Fri, 20 May 2011 18:20:26 +0200 |
Am 20.05.2011 um 18:03 schrieb Stefan Bidi:
> 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.
I think it is because the key of a NSDictionary is always copied to prevent
e.g. problems when
using a NSMutableString as a key and change its value on the fly...
Why aren't you using a NSArray/CFArray to simulate a NSSet? They are much more
similar than
dictionaries and sets.
Nikolaus