After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 586986 - StTextureCache: need to load svg in main thread
StTextureCache: need to load svg in main thread
Status: RESOLVED DUPLICATE of bug 377539
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 648638 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-06-25 20:45 UTC by Colin Walters
Modified: 2011-05-02 17:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Colin Walters 2009-06-25 20:45:50 UTC
Currently Pango is still not listed as threadsafe.  Thus to reliably load svgs we need to do the loading in the main thread.
Comment 1 Dan Winship 2009-11-12 20:10:43 UTC
(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...
Comment 2 Owen Taylor 2009-11-12 20:16:33 UTC
(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
Comment 3 Dan Winship 2011-02-08 18:55:29 UTC
is this still true and we're just living dangerously?
Comment 4 Colin Walters 2011-04-25 19:45:11 UTC
*** Bug 648638 has been marked as a duplicate of this bug. ***
Comment 5 Colin Walters 2011-04-25 19:50:19 UTC
(In reply to comment #3)
> is this still true and we're just living dangerously?

Good question.  Behdad?
Comment 6 Behdad Esfahbod 2011-04-26 22:10:45 UTC
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.
Comment 7 Behdad Esfahbod 2011-04-26 22:18:13 UTC

*** This bug has been marked as a duplicate of bug 377539 ***
Comment 8 Owen Taylor 2011-05-02 15:54:53 UTC
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.)
Comment 9 Behdad Esfahbod 2011-05-02 17:06:12 UTC
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
Comment 10 Behdad Esfahbod 2011-05-02 17:09:08 UTC
Humm.  Perhaps not.  My bad.  Still investigating.
Comment 11 Behdad Esfahbod 2011-05-02 17:22:10 UTC
Nope.  I'm giving up.  The trace doesn't make sense.