CGImageSourceCopyPropertiesAtIndex fails sometimes
CGImageSourceCopyPropertiesAtIndex fails sometimes
- Subject: CGImageSourceCopyPropertiesAtIndex fails sometimes
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Wed, 25 Sep 2019 17:09:34 +0200
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 (email@hidden)
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:
This email sent to email@hidden