• 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: Document being reopened on launch during modal dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document being reopened on launch during modal dialog


  • Subject: Re: Document being reopened on launch during modal dialog
  • From: Graham Cox <email@hidden>
  • Date: Thu, 08 May 2014 10:08:45 +1000

On 8 May 2014, at 8:08 am, Mills, Steve <email@hidden> wrote:

> Is this all safe and legal, releasing self right before it returns to whatever called it?


I believe so, I've done this rarely but occasionally, and it's OK, though if you forget you've done this and later change the calling behaviour in such a way that you assume the object is still there on return from -runDlog it will crash.

If you want to be safer, you could use -autorelease instead, which will allow it to live a little longer, until the call stack to this point has unwound and returned to the main loop.

There are probably also better ways to set this up in general, such that the runner object is automatically disposed when it's done its job - for example using a block? I've just woken up, so off the top of my head I'm not ready to pinpoint the best approach.

--Graham



_______________________________________________

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


References: 
 >Document being reopened on launch during modal dialog (From: "Mills, Steve" <email@hidden>)
 >Re: Document being reopened on launch during modal dialog (From: Lee Ann Rucker <email@hidden>)
 >Re: Document being reopened on launch during modal dialog (From: Quincey Morris <email@hidden>)
 >Re: Document being reopened on launch during modal dialog (From: Graham Cox <email@hidden>)
 >Re: Document being reopened on launch during modal dialog (From: "Mills, Steve" <email@hidden>)

  • Prev by Date: Re: Document being reopened on launch during modal dialog
  • Next by Date: Re: Document being reopened on launch during modal dialog
  • Previous by thread: Re: Document being reopened on launch during modal dialog
  • Next by thread: Auto layout and re-sizing subviews.
  • Index(es):
    • Date
    • Thread