diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-19 15:19:40 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-19 15:19:40 +0000 |
commit | 3028fbf00d2d571b6f67001b5c09c15e3e2cfa26 (patch) | |
tree | 7be7037d3a0c4d093d1861a15cae812ae8377d54 /draw/draw_glyph.c | |
parent | da81dc0f28246b37a487e8ace9443f2689f855c0 (diff) | |
download | mupdf-3028fbf00d2d571b6f67001b5c09c15e3e2cfa26.tar.xz |
More Memory squeezing fixes
Diffstat (limited to 'draw/draw_glyph.c')
-rw-r--r-- | draw/draw_glyph.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/draw/draw_glyph.c b/draw/draw_glyph.c index 328b79f7..6b83af74 100644 --- a/draw/draw_glyph.c +++ b/draw/draw_glyph.c @@ -133,10 +133,18 @@ fz_render_glyph(fz_context *ctx, fz_glyph_cache *cache, fz_font *font, int gid, { if (cache->total + val->w * val->h > MAX_CACHE_SIZE) fz_evict_glyph_cache(ctx, cache); - fz_keep_font(key.font); - fz_hash_insert(cache->hash, &key, val); + fz_try(ctx) + { + fz_hash_insert(cache->hash, &key, val); + fz_keep_font(key.font); + val = fz_keep_pixmap(val); + } + fz_catch(ctx) + { + fz_warn(ctx, "Failed to encache glyph - continuing"); + } cache->total += val->w * val->h; - return fz_keep_pixmap(val); + return val; } return val; } |