Ah, I think I see what you're saying. I could create a custom CFDictionaryHashCallBack to simply return the pointer value or something, thereby skirting the -hash problem.
Intriguing. I'll play with this and report back. The thing I have against this approach is that it potentially allows for a whole bunch of unused memory to be strongly referenced (the associated value for the no-longer-used key), whereas the dynamic subclass (or dealloc swizzling) approach allowed me to always keep things cleaned up. Dave On Oct 13, 2010, at 3:52 PM, Dave DeLong wrote: > Yeah, thanks for this. I've been over Mike's code, and he gets around this > issue by using class_setSuperclass(), which the documentation says should not > be used. > > How would using a CFDictionary with custom callbacks make things any better? > In order to find things in the dictionary, things are binned by their hash. > Presumably when a CFDictionary needs to grow, it's going to rehash all of the > keys (using CFHash() or -hash), but if some of those keys point to > deallocated memory (ie, the user is not using Garbage Collection), then I'm > liable to crash. This is what necessitated the auto-cleanup subclassing in > the first place. Would a CFMutableDictionaryRef allow me to get around this > issue? > > Dave > > On Oct 13, 2010, at 3:47 PM, Kyle Sluder wrote: > >> Alternatively, you could go back to the NSMapTable approach, but >> instead of using an NSMapTable use a CFDictionary with custom >> callbacks.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com