Re(2): Strange crash, CFBundle*
Re(2): Strange crash, CFBundle*
- Subject: Re(2): Strange crash, CFBundle*
- From: Jens Bauer <email@hidden>
- Date: Tue, 11 Dec 2001 09:31:38 +0100
Hi Douglas,
On Fri, 7 Dec, 2001, Douglas Davidson <email@hidden> wrote:
>
>
On Friday, December 7, 2001, at 09:59 AM, Jens Bauer wrote:
>
>
> I'm having a strange crash (periodically), in the following code:
>
>
Strange crashes of this sort are often due to someone inadvertently
>
releasing something in the internals of a CFBundle, that was returned to
>
them by a "get" function. The release need not be anywhere in the code
>
that actually crashes. Are you by any chance releasing the main bundle,
>
or something else returned from it?
I've gone through much of my code, and I only (personally) release
strings I've
copied myself.
Here's a shortened down version of code I did not write myself:
static bool myfunction()
{
CFBundleRef bundle;
CFURLRef resources;
bundle = CFBundleGetMainBundle();
if(!bundle)
{
return(FALSE);
}
resources = CFBundleCopyResourcesDirectoryURL(bundle);
--> CFRelease(bundle);
if(!resources)
{
return(FALSE);
}
...
...
}
You mention that I should not release something that was returned to me by a
"get" function. Is the above CFRelease(bundle) wrong then ?
Love,
Jens