On Sun, Sep 20, 2009 at 1:37 PM, Matt Neuburg <m...@tidbits.com> wrote:

> On or about 9/20/09 1:16 PM, thus spake "Ken Ferry" <kenfe...@gmail.com>:
>
> > There was an ownership problem.  The NSBitmapImageRep owned a raw buffer
> of
> > data and the CGImage.  The CGImage didn't retain the NSBitmapImageRep
> since
> > that would cause a retain cycle.
>
> So all I had to do was retain the NSBitmapImageRep! I never thought of
> that!!! Argh! [Falls on own sword in despair, is carried off the stage.] m.
>

Well, yes, but copying the data out one way or another is probably safer.
:-)

Once you've passed a CGImage to some other API, you really don't know how
long it'll survive, so it's hard to say when it would be safe to release the
NSBitmapImageRep.

Notably, during printing, even CGContextDrawImage retains the CGImage rather
than using it right away.  The CGImage is retained until the current page is
finished.

-Ken
_______________________________________________

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

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

Reply via email to