Re(4): Strange crash, CFBundle*
Re(4): Strange crash, CFBundle*
- Subject: Re(4): Strange crash, CFBundle*
- From: Jens Bauer <email@hidden>
- Date: Tue, 11 Dec 2001 18:47:15 +0100
Hi Douglas,
On Tue, 11 Dec, 2001, Douglas Davidson <email@hidden> wrote:
{snip}
>
> bundle = CFBundleGetMainBundle();
{snip}
>
> --> CFRelease(bundle);
>
>
>
> You mention that I should not release something that was returned to me
>
> by a
>
> "get" function. Is the above CFRelease(bundle) wrong then ?
>
>
Yes! You will see random crashes if you release the result of
>
CFBundleGetMainBundle().
>
>
Remember the rules: exactly one release for each API call with
>
"create", "copy", or "retain" in it.
>
>
One further point is that you don't actually need to release bundles
>
that you don't want to be unloaded--and the main bundle would fall into
>
this category. Bundle instances are uniqued, so not releasing a bundle
>
doesn't cause a leak if that bundle wasn't going to go away.
The bug is now found and fixed, thanks Douglas. :)
Love,
Jens