• 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: [self release] question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [self release] question...


  • Subject: Re: [self release] question...
  • From: daniel <email@hidden>
  • Date: Fri, 19 Mar 2004 15:08:52 -0800

Since [self release] only releases the *data* associated with your instance, I think it's safe to call it from any *code* that happens to be operating on that instance, as long as you stop accessing the instance variables after you do the release.

So if [self release] is the last thing you do before returning from your method, it should be safe.

You could also use [self autorelease] if you wanted to continue accessing your own data until after you giveu p control...

Daniel

On Friday, March 19, 2004, at 09:36 AM, Aurilien Hugeli wrote:

hi list !

i feel really newbie with this problem, since even after 2 years of cocoa development, i don't understand this basic problem :

well i have a myWindowController (does *not* herit at all from NSWindowController...) which manage one and only one window.
For me, the best solution would be to release the myWindowController when the user close the window it manages.

the myWindowController implements the delegate method windowShouldClose:
in the windowShouldClose:, can i do something like [self release] ?

i feel stupid to ask this, but something shock me with [self release]... i know i can do this in the init method, when self is the class, but can it be done safely from the instance itself ???

thanks to forgive my newbiness ;)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >[self release] question... (From: Aurélien Hugelé <email@hidden>)

  • Prev by Date: Re: detecting long(ish) mouseDown?
  • Next by Date: How to Disable sorting by column in NSTableView
  • Previous by thread: [self release] question...
  • Next by thread: Re: [self release] question...
  • Index(es):
    • Date
    • Thread