From 9909bfe5452b10c677a6cbb410db036fb9788811 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 15 Mar 2016 15:42:30 +0000 Subject: Make all ref changes on storable items Memento trackable. --- source/fitz/store.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/fitz/store.c b/source/fitz/store.c index c2c86b00..b995f915 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -60,6 +60,8 @@ fz_keep_storable(fz_context *ctx, const fz_storable *sc) * sanely throughout the code. */ fz_storable *s = (fz_storable *)sc; + if (s && s->refs > 0) + Memento_takeRef(s); return fz_keep_imp(ctx, s, &s->refs); } @@ -77,6 +79,8 @@ fz_drop_storable(fz_context *ctx, const fz_storable *sc) this method. So we can simply drop the storable object itself without any operations on the fz_store. */ + if (s && s->refs > 0) + Memento_dropRef(s); if (fz_drop_imp(ctx, s, &s->refs)) s->drop(ctx, s); } -- cgit v1.2.3