Comment 17 for bug 1199571

Created attachment 85352
Make usage of freetype thread safe

Current freetype backend is not thread safe. It can cause segmentation fault when threads are not properly handled by applications which use cairo (see and its duplicates).

Attached patch tries to fix this problem by creating FT_Library object for each thread. This is recommended solution by freetype (

It adds a hash table to which FT_Library is added if a new thread needs one. Thread IDs are used as keys for this table.