Re: Crash with extra [CFString release] after changing a bound value in NSTextField
Re: Crash with extra [CFString release] after changing a bound value in NSTextField
- Subject: Re: Crash with extra [CFString release] after changing a bound value in NSTextField
- From: John Link <email@hidden>
- Date: Tue, 08 Mar 2011 12:24:40 -0800 (PST)
Thank you Quincey for your help! Looks like I was reading too much into the
trace, thinking it was a bindings problem. Turns out I had done something like
this:
NSNumber *myNum = [[NSNumber alloc] init];
myNum = [prefs valueForKey:MinimumValue]; // retrieve NSNumber from shared
defaults
// do stuff
[myNum release];
I thought I was releasing the NSNumber I had created, but if I understand
correctly the second line just points myNumber at the autoreleased value
returned from valueForKey. So in addition to the overrelease caused by the last
line, the NSNumber I originally created is orphaned, right?
----- Original Message ----
From: Quincey Morris <email@hidden>
To: John Link <email@hidden>
Cc: email@hidden
Sent: Tue, March 8, 2011 12:08:17 AM
Subject: Re: Crash with extra [CFString release] after changing a bound value in
NSTextField
On Mar 7, 2011, at 14:01, John Link wrote:
> The app launches with the previously used values in the text fields (as
> desired). Immediately clicking the button works fine--text is generated as
> expected. But if I change the value in a text field before clicking the button,
>
> the app crashes. (This happens whether or not I first tab out of the field to
> commit the edit before clicking the button.) The error is:
>
> -[CFString release]: message sent to deallocated instance 0x164d7fd0
So you know this is a memory management error -- a string has been overreleased.
What's your code to "change the value in a text field"?
_______________________________________________
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