From c5c6aa47e4fbc0323c36065a6f8acaaed609f852 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 2 Mar 2012 16:10:48 +0000 Subject: Fix race condition in fz_render_ft_glyph We were dropping the FREETYPE lock before completing the copy out of the glyph. --- fitz/res_font.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fitz') diff --git a/fitz/res_font.c b/fitz/res_font.c index e44be9b6..e4a4d23a 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -393,6 +393,7 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) FT_Matrix m; FT_Vector v; FT_Error fterr; + fz_pixmap *result; trm = fz_adjust_ft_glyph_width(ctx, font, gid, trm); @@ -477,9 +478,10 @@ fz_render_ft_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix trm) fz_unlock(ctx, FZ_LOCK_FREETYPE); return NULL; } - fz_unlock(ctx, FZ_LOCK_FREETYPE); - return fz_copy_ft_bitmap(ctx, face->glyph->bitmap_left, face->glyph->bitmap_top, &face->glyph->bitmap); + result = fz_copy_ft_bitmap(ctx, face->glyph->bitmap_left, face->glyph->bitmap_top, &face->glyph->bitmap); + fz_unlock(ctx, FZ_LOCK_FREETYPE); + return result; } fz_pixmap * -- cgit v1.2.3