On Jan 27, 2010, at 7:27 AM, vincent habchi wrote:

> Let's say I have a ScrollLayer with 9 underlying tiles (CALayer). Each tile 
> has a delegate to provide contents via DrawLayer:inContext:. At init time, 
> these delegates create a linked object that spawns a thread that runs its run 
> loop (I end up therefore with 9 threads). When DrawLayer:inContext: is 
> called, the delegates initializes the CGContextRef variable and sends a 
> message to the run loop of the corresponding thread, starting the refresh 
> code. I set NSLog so I know the drawing function is called. At best, I get a 
> transitory partial display that vanishes at once. At worse, it crashes in 
> aa_render (), called by CGStrokePath – I had to put a global lock to avoid 
> this.

Are you calling -drawLayer:inContext: yourself? if you are, don't do that - 
just call -setNeedsDisplay on the layer, it will do the right thing.

But at the same time, you could probably simplify this a lot by creating 
CGImages with your content and then assign those images as the contents of your 
layers from the main thread. This is almost certainly likely to be simpler and 
less error prone (as well as allowing for a cleaner handoff of content).
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

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