• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Overriding -dealloc on any object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Overriding -dealloc on any object
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: signal(SIGUSR2, SIG_IGN) not respected by Xcode/GDB?
  • Next by Date: Re: signal(SIGUSR2, SIG_IGN) not respected by Xcode/GDB?
  • Previous by thread: Re: Uniquely identifying mounted volumes.
  • Next by thread: Re: Overriding -dealloc on any object
  • Index(es):
    • Date
    • Thread