Skip navigation.
 
mlRe: [OBJC newbie] - Intance variable becomes 'invalid'
FROM : Chas Spillar
DATE : Wed May 31 20:56:39 2006

I recommend that you review the memory management sections of the various
Cocoa books available.

If you requested a string without retaining it, then the string will be
released at the time the autorelease pool is released.

In general, if you use the a call that says "create", "copy", "alloc" then
you have a reference and need to release it with either release or
autorelease.  If you use a call that says "Get", etc. you do not have a
reference and can generally only use it within a limited scope.

Chas.


> From: Graham <<email_removed>>
> Date: Wed, 31 May 2006 14:51:03 -0400
> To: Apple CocoaList <<email_removed>>
> Subject: [OBJC newbie] - Intance variable becomes 'invalid'
>
> Just learning OBJC...
>
> I have a class with an NSString * instance variable.
> Class has two methods, method a sets a value into the string, when
> method b is called and tries to access the string it crashes my app.
> gdb says the string instance is 'invalid'.
> How can an instance variable become invalid? What does it even mean?
> I suspect that since OBJC uses pointers everywhere that the instance
> got stamped on somehow?
> I have been living in the safe world of Java for too long I fear.
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
ml[OBJC newbie] - Intance variable becomes 'invalid' Graham May 31, 20:51
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Moray Taylor May 31, 20:54
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' John Stiles May 31, 20:54
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Chas Spillar May 31, 20:56
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Robert Walker May 31, 20:58
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Chas Spillar May 31, 20:59
mlRe: Re: [OBJC newbie] - Intance variable becomes 'invalid' Graham May 31, 21:15
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Joshua Pennington May 31, 21:36
mlRe: Re: [OBJC newbie] - Intance variable becomes 'invalid' Shawn Erickson May 31, 21:55
mlRe: Re: Re: [OBJC newbie] - Intance variable becomes 'invalid' Graham May 31, 22:14
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Scott Ellsworth May 31, 22:46
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Sherm Pendley May 31, 23:06