summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-03-24 17:24:45 -0400
committerRobin Watts <Robin.Watts@artifex.com>2017-03-24 17:26:27 -0400
commita78618eae9d21783a17858ad7f0ea5ba21f39e90 (patch)
treef32096a1e95de770045232ab2c0a26c69532c38d
parenta22a4994fd5ca4dcf20170f88a5b7fe1a5df49c4 (diff)
downloadmupdf-a78618eae9d21783a17858ad7f0ea5ba21f39e90.tar.xz
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.
-rw-r--r--include/mupdf/fitz/store.h3
-rw-r--r--source/fitz/image.c3
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 =