I have this piece of code in my program:

    CGImageSourceRef sourceRef = CGImageSourceCreateWithURL( (CFURLRef) url, 
NULL );
    if ( sourceRef == NULL )
    {
        ... display error message 1
        return;
    }
    CFDictionaryRef fileProps = CGImageSourceCopyPropertiesAtIndex( sourceRef, 
0, NULL );
    if ( ! fileProps )
    {
        ... display error message 2
        return;
    }

Now, occasionally, I get "error message 2" but not "error message 1",
i.e.,  CGImageSourceCopyPropertiesAtIndex() apparently fails, while 
CGImageSourceCreateWithURL() retuned a valid(?) image source ref.

I am wondering, how this could happen.  Does anyone have a clue?

Furthermore, when I run the program a few minutes later, without any changes 
whatsoever, 
both function calls work just fine, with the same image files!


Puzzled, Gabriel.

PS:
I never understood what the index in CGImageSourceCopyPropertiesAtIndex() is 
meant for,
and I could not find a clue in the docs, and every example uses just 0 ‒
but probably, this is not related to the problem described above.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to