ref: 6dfdaf4d99e435250eb18582fa60b59dc3bbc427
parent: a773c3041e024975241d110989f617f032c4b7e3
author: Behdad Esfahbod <[email protected]>
date: Wed Jan 14 13:21:13 EST 2015
[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'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2015-01-14 Behdad Esfahbod <[email protected]>
+ [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 <[email protected]>
+
[raster] Allocate render pool for mono rasterizer on the stack.
Instead of using the `render_pool' member of `FT_Library' that is
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -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;
}
}
}
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -612,7 +612,6 @@
FT_Raster_Params* params )
{
FT_Error error;
- FT_Bool update = FALSE;
FT_Renderer renderer;
FT_ListNode node;
@@ -646,13 +645,7 @@
/* 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;
}