Hi Matt, It sounds like the bug discussed in this passage from the AppKit release notes <http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKit.html> is what's biting you:
NSBitmapImageRep notable bug fix: -[NSBitmapImageRep CGImage] safer now (New since WWDC 2008) In Leopard, -[NSBitmapImageRep CGImage] would under most circumstances return a CGImage that was not retained by the bitmap rep, but which would cause a crash if its data was accessed (e.g., by drawing it) after the bitmap rep had been destroyed. This is fixed in SnowLeopard. 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. This problem is gone in 10.6. -Ken On Sun, Sep 20, 2009 at 12:58 PM, Matt Neuburg <m...@tidbits.com> wrote: > Okey-dokey, I'm back with more information. I have finally tracked down the > source of my Core Animation crash on 10.5 (the problem, you may recall, is > that it's crashing on 10.5 but working just fine on 10.6). And it has > nothing to do with my build settings after all. > > Here's the story. My animation is a transition based around setting a > layer's contents. The crash, it turns out, has to do with how I'm acquiring > the CGImages used to set the layer's contents. I'm acquiring them from a > "screen shot" of a window (see my thread "adding a page curl transition"). > Like this (v is a window's content view, fglayer is the CALayer that does > the animation): > > NSBitmapImageRep* b = [v bitmapImageRepForCachingDisplayInRect: [v > visibleRect]]; > [v cacheDisplayInRect:[v visibleRect] toBitmapImageRep:b]; > fglayer.contents = (id)[b CGImage]; > > If I set the contents of the layer that way on 10.6, everything is fine. If > I do it on 10.5, I crash during the resulting animation. I am guessing that > the reason has something to do with image / bitmap caching. On 10.5, the > CGImage isn't really there, I'm guessing; it's as if the bitmap and the > CGImage are places to draw to but they don't really have any separate > existence. On 10.6, where the nature of window drawing has changed somehow, > they do exist, and everything works. > > I can solve the problem - prevent the crash - on 10.5 by copying the bitmap > off to a TIFFRepresentation and turning *that* into a CGImage. So from that > point of view the problem is solved! But is there a better way? Is there > some simpler (or "correct") way to make my CGImage real - to say "Draw > here, > draw now?" (I tried things like retaining or copying the CGImage and that > didn't work.) m. > > >>On Sep 16, 2009, at 1:03 PM, Matt Neuburg wrote: > >> > >>> I've already set the SDK and Base to 10.5, and my app does launch > >>> successfully (if I set it to 32 bit) on my Leopard MacBook, and all > >>> of *my* > >>> code runs okay (I'm not making any 10.6-only calls AFAIK), but as > >>> soon as my > >>> app tries to perform an animation (CoreAnimation), it crashes > >>> (here's a > >>> snippet from the crash log): > >>> > >>> Code Type: X86 (Native) > >>> ... > >>> Thread 0 Crashed: > >>> 0 com.apple.CoreGraphics 0x9295ccf0 > >>> sseCGSConvertXXXX8888TransposePermute + 368 > >>> 1 com.apple.CoreGraphics 0x928d9526 argb32_image + 886 > >>> 2 libRIP.A.dylib 0x96031372 ripl_Mark + 38 > >>> 3 libRIP.A.dylib 0x96033977 ripl_BltImage + 1307 > >>> 4 libRIP.A.dylib 0x9601d549 ripc_RenderImage + > >>> 273 > >>> 5 libRIP.A.dylib 0x9602de6a ripc_DrawImage + 5102 > >>> 6 com.apple.CoreGraphics 0x928cd17d CGContextDrawImage > >>> + 397 > >>> 7 com.apple.QuartzCore 0x9425c85f > >>> create_image_by_rendering + > >>> 469 > >>> 8 com.apple.QuartzCore 0x9425c358 > >>> CARenderImageNewWithCGImage > >>> + 928 > >>> 9 com.apple.QuartzCore 0x942842e0 > >>> CARenderPrepareCGImage + 25 > >>> 10 com.apple.QuartzCore 0x942842b5 > >>> CALayerPrepareCommit + 242 > >>> 11 com.apple.QuartzCore 0x94258543 > >>> CAContextCommitTransaction > >>> + 187 > >>> 12 com.apple.QuartzCore 0x94258239 CATransactionCommit > >>> + 229 > >>> ... > > -- > matt neuburg, phd = m...@tidbits.com, <http://www.tidbits.com/matt/> > A fool + a tool + an autorelease pool = cool! > AppleScript: the Definitive Guide - Second Edition! > http://www.tidbits.com/matt/default.html#applescriptthings > > > > _______________________________________________ > > 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/kenferry%40gmail.com > > This email sent to kenfe...@gmail.com > _______________________________________________ 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