[cairo] threading issue in cairo-image-surface.c?

Benjamin Otte otte at redhat.com
Thu Dec 2 00:55:32 PST 2010

Yes, unfortunately pixman is not threadsafe and that causes problems in
Cairo. Various patches exist to make pixman threadsafe, but none of
those have been accepted upstream so far, because, well, threading
abstraction code always looks ugly.


On Wed, 2010-12-01 at 17:55 +0100, Fried, Vojtech wrote:
> Hi, I am experimenting with cairo in our project. It works great but I
> have encountered some problems. This one is most important for me just
> now.
> When I run the test suite for our project in multithreaded mode, it
> crashes in cairo from time to time. The culprit seems to be caching in
> _pixman_*_image functions and in _pixman_image_for_solid. When I disable
> the caches, it seems to work fine. I am not sure about the exact cause
> but it seems to me that pixman_image_ref/pixman_image_unref for cached
> images is called from multiple threads and because it is not atomic
> operation it might make the ref count go to 0 even if it is still owned
> in one of the threads.
> Seen on both linux and windows with cairo 1.10. 
> Vojtech
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list