[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception when using GSDictionary in corebase

From: Stefan Bidi
Subject: Re: Exception when using GSDictionary in corebase
Date: Fri, 20 May 2011 14:26:29 -0500

Well, I didn't mean to start a big discussion about it.  I used a dictionary just because it was easier to add NSCopying to NSCFType than it was to move over to CFArray.

Thanks for the help... my tests are now passing.

On Fri, May 20, 2011 at 12:09 PM, Stefan Bidi <address@hidden> wrote:
On Fri, May 20, 2011 at 11:20 AM, Dr. H. Nikolaus Schaller <address@hidden> wrote:

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...

Ah... Makes sense.  I guess I'll need to add that method to NSCFType.

Why aren't you using a NSArray/CFArray to simulate a NSSet? They are much more similar than
dictionaries and sets.

I'll take a look into it.  Thanks for the pointer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]