diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/document.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source/fitz/document.c b/source/fitz/document.c index 52408ae3..227c93e1 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -26,8 +26,7 @@ fz_document_handler_context *fz_keep_document_handler_context(fz_context *ctx) { if (!ctx || !ctx->handler) return NULL; - ctx->handler->refs++; - return ctx->handler; + return fz_keep_imp(ctx, ctx->handler, &ctx->handler->refs); } void fz_drop_document_handler_context(fz_context *ctx) @@ -35,11 +34,11 @@ void fz_drop_document_handler_context(fz_context *ctx) if (!ctx || !ctx->handler) return; - if (--ctx->handler->refs != 0) - return; - - fz_free(ctx, ctx->handler); - ctx->handler = NULL; + if (fz_drop_imp(ctx, ctx->handler, &ctx->handler->refs)) + { + fz_free(ctx, ctx->handler); + ctx->handler = NULL; + } } void fz_register_document_handler(fz_context *ctx, const fz_document_handler *handler) |