void fz_drop_context(fz_context *ctx) { if (!ctx) return; /* Other finalisation calls go here (in reverse order) */ fz_drop_document_handler_context(ctx); fz_drop_glyph_cache_context(ctx); fz_drop_store_context(ctx); fz_drop_aa_context(ctx); fz_drop_colorspace_context(ctx); fz_drop_font_context(ctx); fz_drop_id_context(ctx); if (ctx->warn) { fz_flush_warnings(ctx); fz_free(ctx, ctx->warn); } if (ctx->error) { assert(ctx->error->top == -1); fz_free(ctx, ctx->error); } /* Free the context itself */ ctx->alloc->free(ctx->alloc->user, ctx); }
MupdfBackend::~MupdfBackend() { if (m_doc) { fz_drop_document(m_ctx, m_doc); m_doc = 0; } if (m_ctx) { fz_drop_document_handler_context(m_ctx); // TODO: is this needed? fz_drop_context(m_ctx); m_ctx = 0; } }