From 333860c5c9c4539f36d3bd0716bc696a6ebddd0f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 2 Feb 2011 15:35:42 +0000 Subject: Store font data buffer in fz_font rather than in pdf_fontdesc. Fixes bug where the fontdesc was evicted from cache while the font still lived on in a display list, with a now stale pointer. --- fitz/fitz.h | 1 + fitz/res_font.c | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'fitz') diff --git a/fitz/fitz.h b/fitz/fitz.h index fcedbebe..b7787acc 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -661,6 +661,7 @@ struct fz_font_s void *ftface; /* has an FT_Face if used */ int ftsubstitute; /* ... substitute metrics */ int fthint; /* ... force hinting for DynaLab fonts */ + unsigned char *ftdata; fz_matrix t3matrix; fz_obj *t3resources; diff --git a/fitz/res_font.c b/fitz/res_font.c index cfbb08bf..2fddcf2a 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -18,6 +18,7 @@ fz_newfont(void) font->ftface = nil; font->ftsubstitute = 0; font->fthint = 0; + font->ftdata = nil; font->t3matrix = fz_identity; font->t3resources = nil; @@ -71,6 +72,9 @@ fz_dropfont(fz_font *font) fz_finalizefreetype(); } + if (font->ftdata) + fz_free(font->ftdata); + if (font->widthtable) fz_free(font->widthtable); -- cgit v1.2.3