• 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
Re: Dynamically subclassing an observed object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically subclassing an observed object


  • Subject: Re: Dynamically subclassing an observed object
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 13 Oct 2010 15:54:36 -0500

On Oct 13, 2010, at 2:44 PM, Dave DeLong wrote:

> I maintain some code that does dynamic subclassing to override an object's -dealloc method to do some extra cleanup prior to deallocation.  (And for the curious, this cleanup is not necessary when using Garbage Collection)

As mentioned, it's not safe to do isa-swizzling because KVO also does it.

Have you considered doing method swizzling on -[NSObject dealloc]?  (And maybe -[NSProxy dealloc], too, I guess.)

Also, have you considered whether you really need to be doing these sorts of hacks at all? ;)  For example, could you get away with objc_setAssociatedObject()?

Regards,
Ken

_______________________________________________

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: Dynamically subclassing an observed object
      • From: Dave DeLong <email@hidden>
References: 
 >Dynamically subclassing an observed object (From: Dave DeLong <email@hidden>)

  • Prev by Date: Re: Dynamically subclassing an observed object
  • Next by Date: Re: Dynamically subclassing an observed object
  • Previous by thread: Re: Dynamically subclassing an observed object
  • Next by thread: Re: Dynamically subclassing an observed object
  • Index(es):
    • Date
    • Thread