• 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
Memory Management - Best practices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory Management - Best practices


  • Subject: Memory Management - Best practices
  • From: Yvan BARTHÉLEMY <email@hidden>
  • Date: Thu, 22 Jan 2009 17:53:06 +0100

Hello,

I am implementing mouse support in Core Animation. For this I have a CAButton : CALayer and adds button-related behavior : highlighting on mouseDown, stopping highlighting on mouseExit, etc. and actions.

The actions are associated using:
 -[CAButton setAction:(SEL) withTarget:(SEL)]

These are performed on mouseUp if the mouse is still within the button's rect.

The problem that occurred is that the action might cause the button to be removed by a side-effect of performSelector (ex. a view switch) and I might still need to perform additional actions that needs button's ivars after performSelector has been called (which might cause unexpected behavior).

When I encounter the problem, I changed mouseUp so it does not need to perform any action after the performSelector. But I am wondering if there are special practices to prevent this problem : should we assume that the button will not be released by the performAction, retain it before the performSelector and release it after, or do not use self after performSelector ?

Thanks for your advice,
Yvan
_______________________________________________

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


  • Prev by Date: Re: OCUnit test failure - assert formatted text not presented
  • Next by Date: Re: Log4Cocoa
  • Previous by thread: Writing to an iFrame with Javascript
  • Next by thread: [SOLVED] NSScrollView Tiger v Leopard
  • Index(es):
    • Date
    • Thread