diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2018-03-12 21:29:31 +0800 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-03-12 14:57:42 +0100 |
commit | a7aac9428675cd576ac2e55fe0a61fa6091ba27a (patch) | |
tree | 4aed5c2c2cbcec296b746bf041a43f03038644c4 | |
parent | e9349d8fc30de9871698e13fd35d61b457cccbc5 (diff) | |
download | mupdf-a7aac9428675cd576ac2e55fe0a61fa6091ba27a.tar.xz |
jni: Fix reference counting when creating PDF annotations.
-rw-r--r-- | platform/java/mupdf_native.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index ccef38c4..af2dd301 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -1464,19 +1464,6 @@ static inline jobject to_Page_safe_own(fz_context *ctx, JNIEnv *env, fz_page *pa return jobj; } -static inline jobject to_PDFAnnotation_safe_own(fz_context *ctx, JNIEnv *env, jobject pdf, pdf_annot *annot) -{ - jobject jannot; - - if (!ctx || !annot || !pdf) return NULL; - - jannot = (*env)->NewObject(env, cls_PDFAnnotation, mid_PDFAnnotation_init, jlong_cast(annot), pdf); - if (!jannot) - pdf_drop_annots(ctx, annot); - - return jannot; -} - static inline jobject to_PDFGraftMap_safe_own(fz_context *ctx, JNIEnv *env, jobject pdf, pdf_graft_map *map) { jobject jmap; @@ -8619,7 +8606,7 @@ FUN(PDFPage_createAnnotation)(JNIEnv *env, jobject self, jint subtype) return NULL; } - return to_PDFAnnotation_safe_own(ctx, env, self, annot); + return to_Annotation_safe(ctx, env, self, (fz_annot*)annot); } JNIEXPORT void JNICALL |