Re: NSToolbarItem action problem
Re: NSToolbarItem action problem
- Subject: Re: NSToolbarItem action problem
- From: Sherm Pendley <email@hidden>
- Date: Mon, 22 Nov 2004 16:52:09 -0500
On Nov 22, 2004, at 4:44 PM, email@hidden wrote:
I have a class that when initialized, creates an NSMutableArray. At
this point, it is valid. I set that class as the target for a
NSToolbarItem. Then i set the action to one of its methods define as
"-(void) doAction:(id)sender". When the NSToolbarItem is pressed, the
action method gets called and goes through fine. As soon as i try and
access any of my instances array data, i crash. Can i access my
instances data when im in an action like this? I checked it out, and
all my instances data is invalid only when im in an action. Whats
going on here?
How are you creating your array? If you're using one of the
"convenience" class methods such as +arrayWithObjects, you'll get an
autoreleased object. If that's what you're doing, you'll need to
explicitly retain the array since you want to keep it for later.
For an excellent discussion of memory management in Cocoa, see the
"Hold me, use me, free me" article on Stepwise:
<http://www.stepwise.com/Articles/Technical/HoldMe.html>
sherm--
_______________________________________________
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