From d5a22b7c76c7c0f67f9350b2a7a5dc030b212421 Mon Sep 17 00:00:00 2001 From: Matt Holgate Date: Tue, 17 Jun 2014 11:14:39 +0100 Subject: 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? --- platform/android/jni/mupdf.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'platform/android') 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; -- cgit v1.2.3