[base] Do not reorder library->renderers upon use.

Instead of keeping `library->renderers' in a MRU order, just leave
it as-is.  The MRU machinery wasn't thread-safe.

With this patch, rasterizing glyphs from different faces from
different threads doesn't fail choosing rasterizer
(FT_Err_Cannot_Render_Glyph).

Easiest to see that crash was to add a `printf' (or otherwise let
thread yield in FT_Throw with debugging enabled).

* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Render): Don't call `FT_Set_Renderer'.
This commit is contained in:
Behdad Esfahbod 2015-01-14 18:21:13 +01:00 committed by Werner Lemberg
parent a773c3041e
commit 6dfdaf4d99
3 changed files with 18 additions and 19 deletions

View File

@ -1,3 +1,20 @@
2015-01-14 Behdad Esfahbod <behdad@behdad.org>
[base] Do not reorder library->renderers upon use.
Instead of keeping `library->renderers' in a MRU order, just leave
it as-is. The MRU machinery wasn't thread-safe.
With this patch, rasterizing glyphs from different faces from
different threads doesn't fail choosing rasterizer
(FT_Err_Cannot_Render_Glyph).
Easiest to see that crash was to add a `printf' (or otherwise let
thread yield in FT_Throw with debugging enabled).
* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Render): Don't call `FT_Set_Renderer'.
2015-01-14 Behdad Esfahbod <behdad@behdad.org>
[raster] Allocate render pool for mono rasterizer on the stack.

View File

@ -4084,8 +4084,7 @@
default:
{
FT_ListNode node = 0;
FT_Bool update = 0;
FT_ListNode node = 0;
/* small shortcut for the very common case */
@ -4112,16 +4111,6 @@
/* now, look for another renderer that supports the same */
/* format. */
renderer = FT_Lookup_Renderer( library, slot->format, &node );
update = 1;
}
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one */
if ( !error && update && renderer )
{
error = FT_Set_Renderer( library, renderer, 0, 0 );
if ( error )
break;
}
}
}

View File

@ -612,7 +612,6 @@
FT_Raster_Params* params )
{
FT_Error error;
FT_Bool update = FALSE;
FT_Renderer renderer;
FT_ListNode node;
@ -646,14 +645,8 @@
/* format */
renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE,
&node );
update = TRUE;
}
/* if we changed the current renderer for the glyph image format */
/* we need to select it as the next current one */
if ( !error && update && renderer )
error = FT_Set_Renderer( library, renderer, 0, 0 );
return error;
}