[cairo-bugs] [Bug 73012] Improve thread safety of Cairo Font on Windows

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Dec 24 01:35:07 PST 2013


https://bugs.freedesktop.org/show_bug.cgi?id=73012

--- Comment #1 from Fan, Chun-wei <fanc999 at yahoo.com.tw> ---
Created attachment 91176
  --> https://bugs.freedesktop.org/attachment.cgi?id=91176&action=edit
Attempt to make cairo-win32-font.c thread-safe

Hi,

Lufy D.Monkey's have come up with a patch[1][2] that attempts to make
cairo-win32-
font.c thread-safe.  I have adapted his patch (which was dated back to 2010) so
that it fits in the current state of the code.  Basically what happens is that
the HDC's creations/releases are guarded by mutexes and the created HDC's are
cached by thread id's so that they will need to be created and released less
often.

This does not yet fix the PangoCairo situation (although it would fare better
there by reducing intermittent crashes by a whole lot, say from once every 8
runs to 30 runs or so), but I have used this cairocffi Python test[3] to test
this code, and it seems that the fix will allow the test to pass, whereas the
original code will fail with a

MemoryError: ('cairo returned CAIRO_STATUS_NO_MEMORY: out of memory', 1L)

[1]: http://lists.cairographics.org/archives/cairo/2010-July/020336.html
[2]:
http://lists.cairographics.org/archives/cairo/attachments/20100715/8b3a8f05/attachment-0001.obj
[3]:
https://gist.github.com/akx/7307462/raw/13c03a220662928778ab626625cd53251d1ec295/cairocffi-22.py

Merry Christmas, and with blessings, thank you!

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20131224/bbab2321/attachment.html>


More information about the cairo-bugs mailing list