Thread-safety and library versions
Weeble <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CACBComFOsMrrKNs1ex7pAJqXrLZ45HHdS+_rY=osRs2itjBBFg@mail.gmail.com> |
I'm investigating a bug[1] in (or at least affecting) Mono, which exhibits as one of several different crashes in libcairo when trying to perform drawing operations on different threads simultaneously, even when no objects are (knowingly) shared between those threads. From reading the NEWS file, I understand that for libcairo 1.12.10, Behdad Eshfabod fixed a large number of thread-safety issues around font-handling. As far as I can tell, this also involved a number of fixes to fontconfig, which appear in releases numbered 2.10.91 and up, and are not yet in any stable release. (The last stable release is 2.10.2.) Does that mean that at the current time it's not generally possible to use libcairo from multiple threads, unless you can guarantee users will have a development or future version of fontconfig? Or is there some kind of workaround in place for old fontconfigs? Under what circumstances, if any, is it safe to use libcairo from multiple threads? More specifically, I'm running libcairo 1.12.14 and libfontconfig 2.10.2. When Mono repeatedly creates cairo drawing contexts, calls cairo_select_font_face, and destroys the drawing contexts; (with each context accessed only from a single thread, but more than one thread running at once;) sooner or later it crashes when _cairo_toy_font_face_destroy calls _cairo_hash_table_remove and raises an assertion, apparently because the key is missing from the hash table. Could this crash be caused by having an old version of fontconfig? There's no obvious involvement of fontconfig in this stack trace, but if this combination of libraries is known to have thread-safety issues I wonder if it could be due to memory corruption. (Much more rarely, it crashes in FcPatternDestroy, with an assertion about a double-free or memory corruption, so I do have reason to suspect fontconfig, although I am not certain these crashes have the same cause.) Regards, Weeble. [1] - https://bugzilla.xamarin.com/show_bug.cgi?id=2426 -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo