summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2012-04-09 12:08:48 +0100
committerRobin Watts <Robin.Watts@artifex.com>2012-04-09 12:14:57 +0100
commit3f89d1b6d1d28018f8706faefbbac040e4188e1a (patch)
treedbeca90634e89e1df67319a95d12ff969769473c /fitz
parent10c3dc0da2d157723c6bfcdc81dd797430063366 (diff)
downloadmupdf-3f89d1b6d1d28018f8706faefbbac040e4188e1a.tar.xz
Bug 692976: Fix spurious thread lock debug warnings on context clones
When cloning, ensure the locks are done on the new context, not the old one; this makes no difference except to suppress some spurious debugging messages. Also ensure that DEBUG is predefined for Makefile based debug and memento builds. Thanks to Bas Weelinck.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_context.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fitz/base_context.c b/fitz/base_context.c
index 075a3d02..55d74cc3 100644
--- a/fitz/base_context.c
+++ b/fitz/base_context.c
@@ -124,8 +124,12 @@ fz_clone_context_internal(fz_context *ctx)
new_ctx = new_context_phase1(ctx->alloc, ctx->locks);
/* Inherit AA defaults from old context. */
fz_copy_aa_context(new_ctx, ctx);
- new_ctx->store = fz_keep_store_context(ctx);
- new_ctx->glyph_cache = fz_keep_glyph_cache(ctx);
- new_ctx->font = fz_keep_font_context(ctx);
+ /* Keep thread lock checking happy by copying pointers first and locking under new context */
+ new_ctx->store = ctx->store;
+ new_ctx->store = fz_keep_store_context(new_ctx);
+ new_ctx->glyph_cache = ctx->glyph_cache;
+ new_ctx->glyph_cache = fz_keep_glyph_cache(new_ctx);
+ new_ctx->font = ctx->font;
+ new_ctx->font = fz_keep_font_context(new_ctx);
return new_ctx;
}