GNOME Bugzilla – Bug 586986
StTextureCache: need to load svg in main thread
Last modified: 2011-05-02 17:22:10 UTC
Currently Pango is still not listed as threadsafe. Thus to reliably load svgs we need to do the loading in the main thread.
(In reply to comment #0) > Currently Pango is still not listed as threadsafe. Thus to reliably load svgs > we need to do the loading in the main thread. er? did you mean something other than "pango" there? "librsvg" maybe? also, the RsvgHandle would be created and destroyed in a single thread...
(In reply to comment #1) > (In reply to comment #0) > > Currently Pango is still not listed as threadsafe. Thus to reliably load svgs > > we need to do the loading in the main thread. > > er? did you mean something other than "pango" there? "librsvg" maybe? > > also, the RsvgHandle would be created and destroyed in a single thread... librsvg uses Pango, Pango is also being used from the main thread: problem
is this still true and we're just living dangerously?
*** Bug 648638 has been marked as a duplicate of this bug. ***
(In reply to comment #3) > is this still true and we're just living dangerously? Good question. Behdad?
Living dangerously. I fixed a bug a couple years ago that made this a bit better. Still, just being lucky. It's actually not *that* hard to fix pango. For the most part, we need: - Use g_once_init/leave around all static data, - Use g_object_lock/unlock (bug 608695) whenever accessing/modifying shared objects (fontmaps mostly, as fonts, families, etc are for the most part immutable after construction). I can look into it if someone makes g_object_lock() happen.
*** This bug has been marked as a duplicate of bug 377539 ***
https://bugzilla.redhat.com/show_bug.cgi?id=698589 shows a crash when the main thread and a SVG loading thread are both trying to use FreeType and we get a double free or memory corruption. Interestingly (the reason why I mention it) the crash really looks more like a cairo bug; it's a little hard to see how Pango non-thread-safety could trigger a crash given the backtraces. (But if Pango is corrupting memory elsewhere, then of course, all bets are off.)
Wow, that trace is gold! I easily tracked the bug down. Pushing to cairo master. diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index acb7121..4313148 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -2142,7 +2142,7 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, vertical_layout = TRUE; } - error = FT_Load_Glyph (scaled_font->unscaled->face, + error = FT_Load_Glyph (face, _cairo_scaled_glyph_index(scaled_glyph), load_flags); /* XXX ignoring all other errors for now. They are not fatal, typically
Humm. Perhaps not. My bad. Still investigating.
Nope. I'm giving up. The trace doesn't make sense.