diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-10-02 14:56:07 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-10-02 15:18:39 +0100 |
commit | 6d57575a362af052cbc43f00fba5d853bc81767c (patch) | |
tree | fe7e9de79303ad89b67da450349850fbcb8fb3fe /source/fitz | |
parent | 0dda0e13f481d1243fb88a576fc41fe9a7deac62 (diff) | |
download | mupdf-6d57575a362af052cbc43f00fba5d853bc81767c.tar.xz |
fz_link fixes.
Make fz_link reference counting threadsafe.
Remember to free dests of GOTO links. Accordingly, ensure that XPS
does not create links with uninitialised dests.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/link.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/fitz/link.c b/source/fitz/link.c index 152d48ea..20668ab1 100644 --- a/source/fitz/link.c +++ b/source/fitz/link.c @@ -6,7 +6,9 @@ fz_drop_link_dest(fz_context *ctx, fz_link_dest *dest) switch (dest->kind) { case FZ_LINK_NONE: + break; case FZ_LINK_GOTO: + fz_free(ctx, dest->ld.gotor.dest); break; case FZ_LINK_URI: fz_free(ctx, dest->ld.uri.uri); @@ -47,15 +49,13 @@ fz_new_link(fz_context *ctx, const fz_rect *bbox, fz_link_dest dest) fz_link * fz_keep_link(fz_context *ctx, fz_link *link) { - if (link) - link->refs++; - return link; + return fz_keep_imp(ctx, link, &link->refs); } void fz_drop_link(fz_context *ctx, fz_link *link) { - while (link && --link->refs == 0) + while (fz_drop_imp(ctx, link, &link->refs)) { fz_link *next = link->next; fz_drop_link_dest(ctx, &link->dest); |