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

Re: Class Memory Management


  • Subject: Re: Class Memory Management
  • From: Erik Buck <email@hidden>
  • Date: Mon, 13 Feb 2006 20:12:50 -0500

I have a class with one simple method that accesses an IBOutlet (an
NSPanel to simply either order it to the back or to the front).
However, after the first time in which I access the method in the
class, the IBOutlets are released and then if, at a later time, I
wish to access this method again, it does nothing since, I assume,
the IBOutlet which it is accessing has dealloced.  How do I prevent
this?

Your question is incomprehensible to me.
Class methods can't access instance variables and all IBOutlets are instance variables. Do you perhaps mean you have an instance method that "accesses" an IBOutlet ?


You will have to show us some code to get any kind of sensible answer. For example, what on earth do you mean by "access" a method ? Do you mean send a message to an object ? Do you mean edit the method in a text editor ?

Nothing happens spontaneously in Objective-C. What do you mean IBOutlets are released ? First of all IBOutlets are pointers to objects. Perhaps you mean that the object referenced by the outlet is released ? What makes you think that ? Did you write code to send a release or autorelease message to the object ? If the object which the IBOutlet is "accessing" was truly deallocated, and you "access" is (by sending a message) your application will most likely either crash or very strange things will happen.

The normal way to prevent an object from being deallocated is to retain the object. Does just that statement answer your question ?

Did you perhaps configure you panel in Interface Builder so that it is released when closed ? Are you closing the panel or just ordering it front and back like you claim ?

http://www.cocoadev.com/index.pl?HowToAskQuestions
I have tried to follow http://www.cocoadev.com/index.pl? HowToWriteHelpfulAnswers


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Accessing IBOutlet From non-IBAction Method
  • Next by Date: Re: Processing TIFF/PNG Layers
  • Previous by thread: Re: Class Memory Management
  • Next by thread: [CoreData] How can I use the Undo manager to recover from errors?
  • Index(es):
    • Date
    • Thread