summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/context.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-07-13 00:38:22 +0100
committerRobin Watts <robin.watts@artifex.com>2016-07-13 00:38:53 +0100
commit1072077dcdfc69d3bce64b9ac0ddbaff5c1fc20f (patch)
treeb59c0855a23852e82366aeb48636d00235292ab2 /include/mupdf/fitz/context.h
parent6153a0761831bbc490213df7911ec596b6ea59f2 (diff)
downloadmupdf-1072077dcdfc69d3bce64b9ac0ddbaff5c1fc20f.tar.xz
Fix Memento builds; static references were upsetting refcounting.
Diffstat (limited to 'include/mupdf/fitz/context.h')
-rw-r--r--include/mupdf/fitz/context.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/mupdf/fitz/context.h b/include/mupdf/fitz/context.h
index 5f047721..50e8eeaa 100644
--- a/include/mupdf/fitz/context.h
+++ b/include/mupdf/fitz/context.h
@@ -607,7 +607,8 @@ fz_keep_imp(fz_context *ctx, void *p, int *refs)
{
if (p)
{
- (void)Memento_takeRef(p);
+ if (*refs > 0)
+ (void)Memento_takeRef(p);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
++*refs;
@@ -621,7 +622,8 @@ fz_keep_imp8(fz_context *ctx, void *p, int8_t *refs)
{
if (p)
{
- (void)Memento_takeRef(p);
+ if (*refs > 0)
+ (void)Memento_takeRef(p);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
++*refs;
@@ -635,7 +637,8 @@ fz_keep_imp16(fz_context *ctx, void *p, int16_t *refs)
{
if (p)
{
- (void)Memento_takeRef(p);
+ if (*refs > 0)
+ (void)Memento_takeRef(p);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
++*refs;
@@ -650,7 +653,8 @@ fz_drop_imp(fz_context *ctx, void *p, int *refs)
if (p)
{
int drop;
- (void)Memento_dropRef(p);
+ if (*refs > 0)
+ (void)Memento_dropRef(p);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
drop = --*refs == 0;
@@ -668,7 +672,8 @@ fz_drop_imp8(fz_context *ctx, void *p, int8_t *refs)
if (p)
{
int drop;
- (void)Memento_dropRef(p);
+ if (*refs > 0)
+ (void)Memento_dropRef(p);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
drop = --*refs == 0;
@@ -686,7 +691,8 @@ fz_drop_imp16(fz_context *ctx, void *p, int16_t *refs)
if (p)
{
int drop;
- (void)Memento_dropRef(p);
+ if (*refs > 0)
+ (void)Memento_dropRef(p);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
drop = --*refs == 0;