• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CGImageSourceCopyPropertiesAtIndex fails sometimes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: CGImageSourceCopyPropertiesAtIndex fails sometimes
      • From: "Gary L. Wade via Cocoa-dev" <email@hidden>
  • Prev by Date: NSMenuItem : acceptsFirstMouse(forEvent: NSEvent)
  • Next by Date: Re: CGImageSourceCopyPropertiesAtIndex fails sometimes
  • Previous by thread: Re: NSMenuItem : acceptsFirstMouse(forEvent: NSEvent)
  • Next by thread: Re: CGImageSourceCopyPropertiesAtIndex fails sometimes
  • Index(es):
    • Date
    • Thread