summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-03-02 16:10:48 +0000
committerRobin Watts <robin.watts@artifex.com>2012-03-02 16:10:48 +0000
commitc5c6aa47e4fbc0323c36065a6f8acaaed609f852 (patch)
treeb6090de8a17ce392a5e577d233850edb9db40e79 /fitz
parentea671d1254dad3b9ef5a8fbdd9729c3ada2a49b2 (diff)
downloadmupdf-c5c6aa47e4fbc0323c36065a6f8acaaed609f852.tar.xz
Fix race condition in fz_render_ft_glyph
We were dropping the FREETYPE lock before completing the copy out of the glyph.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/res_font.c6
1 files changed, 4 insertions, 2 deletions
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 *