You can of course inspect CFBundle.c in the CF-368.11 (10.4.2) Darwin
project :-)
Cheers,
H.
On 10/27/05, Steve Baxter <email@hidden> wrote:
> Hi,
>
> Just found this nasty buglet with CFBundles that I thought I would
> share in case it bites anyone else. If you create a CFBundleRef
> twice using the same file but with different paths, then release one
> of them, it is no longer possible to access the first bundle by ID.
> This code snippet describes the problem:
>
> // Load the same bundle twice with two different paths, when the
> second instance is released the
> // first also goes missing
> CFURLRef urlA = ::CFURLCreateWithFileSystemPath( NULL, CFSTR("/
> System/Library/Frameworks/Carbon.framework"), kCFURLPOSIXPathStyle,
> true );
> CFURLRef urlB = ::CFURLCreateWithFileSystemPath( NULL, CFSTR("/
> System/../System/Library/Frameworks/Carbon.framework"),
> kCFURLPOSIXPathStyle, true );
>
> // Load A
> CFBundleRef bundleA = ::CFBundleCreate( NULL, urlA );
> ASSERT( bundleA );
>
> // Get the identifier for A
> CFStringRef idA = ::CFBundleGetIdentifier( bundleA );
>
> // Load B - this is the same bundle bit with a different path -
> note that bundleA and bundleB
> // should be the same but they are not
> CFBundleRef bundleB = ::CFBundleCreate( NULL, urlB );
> ASSERT( bundleB );
>
> // Release B
> ::CFRelease( bundleB );
>
> // Now try and get our bundle by ID - this will return NULL
> CFBundleRef bundleAByID = ::CFBundleGetBundleWithIdentifier( idA );
> ASSERT( bundleAByID );
>
> I suspect this is because CFURL does not have a proper "compare"
> function that will work out whether two paths really point to the
> same thing. Just another reason why paths are bad (m'kay)!
>
> Reported: radr://4318699
>
> Cheers,
>
> Steve.
>
> Stephen Baxter
> Software Development Manager
> Improvision
> email@hidden
> +44-2476-692229
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Carbon-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/carbon-dev/email@hidden
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden