<div>I have a crash inside freetype and it seems to be related to how cairo uses freetype. But I am not very familiar to say for sure. </div><div><br></div><div>The crash call stack is below</div><div><br></div><div>current thread: t@121</div>
<div>=>[1] af_latin_hints_compute_edges(<b>hints = 0x128623eb0</b>, dim = AF_DIMENSION_HORZ), line 1039 in "aflatin.c"</div><div> [2] af_latin_hints_detect_features(hints = 0x128623eb0, dim = AF_DIMENSION_HORZ), line 1207 in "aflatin.c"</div>
<div> [3] af_latin_hints_apply(hints = 0x128623eb0, outline = 0x100cb61b8, metrics = 0x125a15f80), line 1951 in "aflatin.c"</div><div> [4] af_loader_load_g(loader = 0x128623e98, scaler = 0xffffffff27edefb8, glyph_index = 23U, load_flags = 2561, depth = 0), line 165 in "afloader.c"</div>
<div> [5] af_loader_load_glyph(loader = 0x128623e98, face = 0x1282a00c0, gindex = 23U, load_flags = 2561U), line 484 in "afloader.c"</div><div> [6] af_autofitter_load_glyph(module = 0x128623e70, slot = 0x128086e90, size = 0x1002135f0, glyph_index = 23U, load_flags = 512), line 57 in "afmodule.c"</div>
<div> [7] FT_Load_Glyph(<b>face = 0x1282a00c0</b>, glyph_index = 23U, load_flags = 512), line 612 in "ftobjs.c"</div><div> [8] _cairo_ft_scaled_glyph_init(abstract_font = 0x1230a66a0, scaled_glyph = 0x1243639c8, info = CAIRO_SCALED_GLYPH_INFO_METRICS), line 2159 in "cairo-ft-font.c"</div>
<div> [9] _cairo_scaled_glyph_lookup(scaled_font = 0x1230a66a0, index = 23U, info = CAIRO_SCALED_GLYPH_INFO_METRICS, scaled_glyph_ret = 0xffffffff27edf520), line 2934 in "cairo-scaled-font.c"</div><div> [10] cairo_scaled_font_text_to_glyphs_internal_uncached(scaled_font = 0x1230a66a0, x = 4.0, y = 0.0, utf8 = 0x124365cb0 "$ 4,000", glyphs = 0x123354400, clusters = (nil), num_chars = 8), line 1755 in "cairo-scaled-font.c"</div>
<div> [11] cairo_scaled_font_text_to_glyphs(scaled_font = 0x1230a66a0, x = 0.0, y = 0.0, utf8 = 0x124365cb0 "$ 4,000", utf8_len = 8, glyphs = 0xffffffff27edf7c0, num_glyphs = 0xffffffff27edf7bc, clusters = (nil), num_clusters = (nil), cluster_flags = (nil)), line 2076 in "cairo-scaled-font.c"</div>
<div> [12] cairo_text_extents(cr = 0x1243660c0, utf8 = 0x124365cb0 "$ 4,000", extents = 0xffffffff27edf8c0), line 3094 in "cairo.c"</div><div><br></div><div>The crash happens on the statement </div>
<div>
found->last->edge_next = seg</div><div>At the time of crash found->last is null.</div><div><br></div><div>I found another thread executing in the same function</div><div>current thread: t@102</div><div>=>[1] af_latin_hints_compute_edges(hints = 0x128623eb0, dim = AF_DIMENSION_HORZ), line 1153 in "aflatin.c"</div>
<div> [2] af_latin_hints_detect_features(hints = 0x128623eb0, dim = AF_DIMENSION_HORZ), line 1207 in "aflatin.c"</div><div> [3] af_latin_hints_apply(hints = 0x128623eb0, outline = 0x100cb61b8, metrics = 0x1165c2310), line 1951 in "aflatin.c"</div>
<div> [4] af_loader_load_g(loader = 0x128623e98, scaler = 0xffffffff2b7d6568, glyph_index = 70U, load_flags = 2561, depth = 0), line 165 in "afloader.c"</div><div> [5] af_loader_load_glyph(loader = 0x128623e98, face = 0x129c98910, gindex = 70U, load_flags = 2561U), line 484 in "afloader.c"</div>
<div> [6] af_autofitter_load_glyph(module = 0x128623e70, slot = 0x1165c65d0, size = 0x103312420, glyph_index = 70U, load_flags = 512), line 57 in "afmodule.c"</div><div> [7] FT_Load_Glyph(face = 0x129c98910, glyph_index = 70U, load_flags = 512), line 612 in "ftobjs.c"</div>
<div> [8] _cairo_ft_scaled_glyph_init(abstract_font = 0x124367000, scaled_glyph = 0x122e96a48, info = CAIRO_SCALED_GLYPH_INFO_METRICS), line 2159 in "cairo-ft-font.c"</div><div> [9] _cairo_scaled_glyph_lookup(scaled_font = 0x124367000, index = 70U, info = CAIRO_SCALED_GLYPH_INFO_METRICS, scaled_glyph_ret = 0xffffffff2b7d6ad0), line 2934 in "cairo-scaled-font.c"</div>
<div> [10] cairo_scaled_font_text_to_glyphs_internal_cached(scaled_font = 0x124367000, x = 10.0, y = 0.0, utf8 = 0xffffffff2b7d7d0e "Secondary Dataset 1", glyphs = 0x124360ef0, clusters = (nil), num_chars = 19), line 1695 in "cairo-scaled-font.c"</div>
<div> [11] cairo_scaled_font_text_to_glyphs(scaled_font = 0x124367000, x = 0.0, y = 0.0, utf8 = 0xffffffff2b7d7d0e "Secondary Dataset 1", utf8_len = 19, glyphs = 0xffffffff2b7d7470, num_glyphs = 0xffffffff2b7d746c, clusters = (nil), num_clusters = (nil), cluster_flags = (nil)), line 2069 in "cairo-scaled-font.c"</div>
<div> [12] cairo_text_extents(cr = 0x1243610c0, utf8 = 0xffffffff2b7d7d0e "Secondary Dataset 1", extents = 0xffffffff2b7d7570), line 3094 in "cairo.c"</div><div> </div><div>The hints object comes from the freetype library which is initialized once in _cairo_ft_unscaled_font_map_create. So all the faces use the same freetype library. Wouldn't this lead to race conditions?</div>
<div><br></div><div>The cairo version I am using is 1.12.2 and freetype is 2.2.1</div><div><br></div><div>Thank you</div><div>Joseph</div>