summaryrefslogtreecommitdiff
path: root/source/fitz/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/context.c')
-rw-r--r--source/fitz/context.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/fitz/context.c b/source/fitz/context.c
index 44f96993..53f820a1 100644
--- a/source/fitz/context.c
+++ b/source/fitz/context.c
@@ -120,6 +120,7 @@ new_context_phase1(fz_alloc_context *alloc, fz_locks_context *locks)
if (!ctx)
return NULL;
memset(ctx, 0, sizeof *ctx);
+ ctx->user = NULL;
ctx->alloc = alloc;
ctx->locks = locks;
@@ -223,6 +224,7 @@ fz_clone_context_internal(fz_context *ctx)
fz_copy_aa_context(new_ctx, ctx);
/* Keep thread lock checking happy by copying pointers first and locking under new context */
+ new_ctx->user = ctx->user;
new_ctx->store = ctx->store;
new_ctx->store = fz_keep_store_context(new_ctx);
new_ctx->glyph_cache = ctx->glyph_cache;
@@ -253,3 +255,17 @@ fz_gen_id(fz_context *ctx)
fz_unlock(ctx, FZ_LOCK_ALLOC);
return id;
}
+
+void fz_set_user_context(fz_context *ctx, void *user)
+{
+ if (ctx != NULL)
+ ctx->user = user;
+}
+
+void *fz_user_context(fz_context *ctx)
+{
+ if (ctx == NULL)
+ return NULL;
+
+ return ctx->user;
+}