Overriding -dealloc on any object
Overriding -dealloc on any object
- Subject: Overriding -dealloc on any object
- From: Ryan Joseph <email@hidden>
- Date: Wed, 25 Mar 2009 20:29:07 +0700
I'm working on a Cocoa bridge for Pascal and looking for a solution to
manage the wrapper objects that are directly related to all their
Objective-C counterparts, and therefore must be released in pairs. I
understand that -dealloc is the designated location to release
instances owned by the object so the plan is to override -dealloc on
any object that a wrapper is allocated for.
The question is, will it be safe to override methods like
initWithObjects: that are owned by Cocoa and created through
convenience functions? Will those objects be sent -dealloc also?
Second, given the Objective-C runtime should I replace the
implementation using class_replaceMethod or do I need to add a new
method using class_addMethod? I did observe that -dealloc does indeed
have an implementation so I'm not sure class_addMethod will even have
any affect, but I'm not sure replace the implementation is safe
either. Any help is appreciated. Thanks!
Regards,
Josef
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden