small medium large xlarge

Generic-user-small
03 Jan 2009, 15:41
Michael Keith (4 posts)

when i build & run the example code the quartz composition appears, but does not animate. i’m baffled as to why this is - the earlier QC example (in the Core Animation chapter) runs fine.. and if i create a new project and copy QuartzCompositionView.h/.m into it, it works fine. could it be something to do with the project? weird.

also.. i think that after creating the animation, i.e.:

animation = [CABasicAnimation animationWithKeyPath:keyPath];

the animation should be retained. if you click multiple times, then it’ll crash the on the third click due to the animation being released, but the static var is still pointing to the old mem.

Biopic_100x100_pragsmall
04 Jan 2009, 22:59
Bill Dudney (917 posts)

Hi Michael,

You are mostly correct about the memory issues. However garbage collection is turned on so they objects should be fine.

Unfortunately there continue to be bugs in the GC aspect of the OpenGL/Quartz stuff with Core Animation. Early on (10.5.0) things did not work with GC, later (when we released the book) they did now in 10.5.6 they don’t appear to work any more.

If you look in the console (command-shift-r) you should see a message like this;

bq. -[QCCompositionLayer copyCGLContextForPixelFormat:]: Inconsistent state

I’ve not had a chance to track it down but my guess is something is not GC friendly in the pixel format stuff. But that is just a guess.

Anyway, if you go into the build settings for the target you can turn garbage collection to ‘not supported’ and the app will work as expected/intended.

Thanks for reporting this! I will update the project and get new source uploaded to the books site as soon as I can.

You must be logged in to comment