diff options
author | Matt Holgate <matt@emobix.co.uk> | 2014-06-17 11:14:39 +0100 |
---|---|---|
committer | Matt Holgate <matt@emobix.co.uk> | 2014-06-17 11:14:39 +0100 |
commit | d5a22b7c76c7c0f67f9350b2a7a5dc030b212421 (patch) | |
tree | cf8fad1957e781910ddf4cd54ca1a3defca91bf2 /platform/android | |
parent | ca2668fc29cfe4180ae672050fbea67d4a1023a2 (diff) | |
download | mupdf-d5a22b7c76c7c0f67f9350b2a7a5dc030b212421.tar.xz |
Fix for bug #694967 - MuPDF crashes after pressing the Back Button while it renders a specific PDF
Some async tasks were still trying to access the globals pointer, which had
been nulled during shutdown, leading to a crash.
Check for NULL and return cleanly in this case.
Possibly we should also be calling AsyncTask.get() to wait for the tasks to
finish, before nulling the global pointer?
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/jni/mupdf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c index d9252842..53cb7b3a 100644 --- a/platform/android/jni/mupdf.c +++ b/platform/android/jni/mupdf.c @@ -515,6 +515,8 @@ JNI_FN(MuPDFCore_gotoPageInternal)(JNIEnv *env, jobject thiz, int page) fz_irect bbox; page_cache *pc; globals *glo = get_globals(env, thiz); + if (glo == NULL) + return; fz_context *ctx = glo->ctx; for (i = 0; i < NUM_CACHE; i++) @@ -1803,6 +1805,8 @@ JNI_FN(MuPDFCore_getWidgetAreasInternal)(JNIEnv * env, jobject thiz, int pageNum int count; page_cache *pc; globals *glo = get_globals(env, thiz); + if (glo == NULL) + return NULL; rectFClass = (*env)->FindClass(env, "android/graphics/RectF"); if (rectFClass == NULL) return NULL; @@ -1860,6 +1864,8 @@ JNI_FN(MuPDFCore_getAnnotationsInternal)(JNIEnv * env, jobject thiz, int pageNum int count; page_cache *pc; globals *glo = get_globals(env, thiz); + if (glo == NULL) + return NULL; annotClass = (*env)->FindClass(env, PACKAGENAME "/Annotation"); if (annotClass == NULL) return NULL; |