From a78618eae9d21783a17858ad7f0ea5ba21f39e90 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 24 Mar 2017 17:24:45 -0400 Subject: Fix needs_reap entry in key storable. There is no need to hold a separate flag to say that we need reaping, when this can be implied from the store_key_refs and the normal refcount being equal. In addition, I don't think we were ever actually setting this, so the code was wrong to start with. --- include/mupdf/fitz/store.h | 3 +-- source/fitz/image.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mupdf/fitz/store.h b/include/mupdf/fitz/store.h index d637b1cc..65b041f3 100644 --- a/include/mupdf/fitz/store.h +++ b/include/mupdf/fitz/store.h @@ -39,7 +39,6 @@ struct fz_storable_s { struct fz_key_storable_s { fz_storable storable; short store_key_refs; - unsigned short needs_reaping; }; #define FZ_INIT_STORABLE(S_,RC,DROP) \ @@ -49,7 +48,7 @@ struct fz_key_storable_s { #define FZ_INIT_KEY_STORABLE(KS_,RC,DROP) \ do { fz_key_storable *KS = &(KS_)->key_storable; KS->store_key_refs = 0;\ - KS->needs_reaping = 0; FZ_INIT_STORABLE(KS,RC,DROP); \ + FZ_INIT_STORABLE(KS,RC,DROP); \ } while (0) void *fz_keep_storable(fz_context *, const fz_storable *); diff --git a/source/fitz/image.c b/source/fitz/image.c index 3b0a93d6..9e7717d6 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -92,8 +92,9 @@ static int fz_needs_reap_image_key(fz_context *ctx, void *key_) { fz_image_key *key = (fz_image_key *)key_; + fz_key_storable *ks = &key->image->key_storable; - return (key->image->key_storable.needs_reaping); + return (ks->store_key_refs == ks->storable.refs); } static const fz_store_type fz_image_store_type = -- cgit v1.2.3