Subject: Overriding -dealloc on any object
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!
Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)
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 maillists@xxxxxxxxx