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: > On Wed, Oct 13, 2010 at 2:02 PM, Dave DeLong <davedel...@me.com> wrote: >> As for the rationale behind why I need to do this, I'll just refer to my >> blog post on the matter: >> http://davedelong.com/blog/2010/10/07/fun-objective-c-dynamic-subclassing > > Funny enough, it sounds like the blog post I linked you to (and the > ones following it) that talks about MAZeroingWeakRef does precisely > what you need: http://www.mikeash.com/pyblog/introducing-mazeroingweakref.html > > You can find Mike's code on github. > > Alternatively, you could go back to the NSMapTable approach, but > instead of using an NSMapTable use a CFDictionary with custom > callbacks. > > --Kyle Sluder
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