Re: Simple array controller master-detail binding problem
Re: Simple array controller master-detail binding problem
- Subject: Re: Simple array controller master-detail binding problem
- From: Leon Starr <email@hidden>
- Date: Mon, 24 Aug 2009 09:58:54 -0700
Yes it does, Kyle! I was so focused on being an array controller
binding idiot that I forgot that I was also a memory management fool.
I was about to google that NSZombie thing - which I will do next, when
I took one more look at the code, this time with a clear focus on
memory. The releases looked reasonable, leaving only the possibility
of a missing retain somewhere.... Voila! I added a retain message
where I create the weapons array in the Combatant class. Awesome - it
works!!!
- (id)init{
NSLog(@"Initializing combatant");
[super init];
// Create initial weapons
weapons = [[NSMutableArray arrayWithObjects:@"Dagger", @"Sword",
@"Pike", nil] retain];
return self;
}
Pardon my thinking as I write.... I am guessing I need the retain
because this thing is being autoreleased. AND it worked in the
command line because the pool isn't drained in the middle of my
session, but with a GUI it is drained on each event loop. Of course.
Duh. Thanks guys!
- Leon
On Aug 24, 2009, at 9:37 , Kyle Sluder wrote:
On Mon, Aug 24, 2009 at 9:14 AM, Leon Starr<email@hidden>
wrote:
There was no error message in the session when I originally
submitted my
question. But I just tried running my code (unchanged) this
morning several
times and found that SOMETIMES I get an error in the console just
before the
stack trace. And it is not always exactly the same, but the theme is
similar. It always involves something about not being able to
create an
array. Here's the latest:
Smells like memory mismanagement. Set NSZombieEnabled=YES (Google for
NSZombie if you don't know what that means) and try again.
--Kyle Sluder
_______________________________________________
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