diff options
author | fred ross-perry <fredross-perry@Fred-Ross-Perrys-Computer.local> | 2016-08-09 17:33:52 -0700 |
---|---|---|
committer | fredross-perry <fross-perry@conceptuamath.com> | 2016-08-16 11:21:02 -0700 |
commit | f1b8593a2289060430763b1d918f4b3c9debe6f3 (patch) | |
tree | d026c160146dc50dcf94374f90ffc6b2a19db71e | |
parent | e7fa2ff8f4763ae18d194e82943a68c75cb9d28b (diff) | |
download | mupdf-f1b8593a2289060430763b1d918f4b3c9debe6f3.tar.xz |
Android example - fix a crash bug by recycling bitmaps between documents.
3 files changed, 24 insertions, 0 deletions
diff --git a/platform/android/example/app/src/main/java/com/artifex/mupdf/example/DocViewActivity.java b/platform/android/example/app/src/main/java/com/artifex/mupdf/example/DocViewActivity.java index 4d07c8dd..5a23c5fd 100755 --- a/platform/android/example/app/src/main/java/com/artifex/mupdf/example/DocViewActivity.java +++ b/platform/android/example/app/src/main/java/com/artifex/mupdf/example/DocViewActivity.java @@ -27,4 +27,13 @@ public class DocViewActivity extends Activity mDocActivityView.showUI(true); // set to false for no built-in UI mDocActivityView.start(path); } + + @Override + public void finish() + { + // stop the view + mDocActivityView.stop(); + + super.finish(); + } } diff --git a/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocActivityView.java b/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocActivityView.java index c1bf3472..dc9c75fd 100644 --- a/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocActivityView.java +++ b/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocActivityView.java @@ -340,4 +340,13 @@ public class DocActivityView extends FrameLayout implements TabHost.OnTabChangeL requestLayout(); } } + + public void stop() + { + mDocView.finish(); + if (usePagesView()) + { + mDocView2.finish(); + } + } } diff --git a/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java b/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java index bb9d422d..71cf1bbf 100755 --- a/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java +++ b/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java @@ -920,6 +920,12 @@ public class DocViewBase removeViewInLayout(cv); cv.finish(); } + + // get rid of bitmaps + bitmaps[0].recycle(); + bitmaps[0] = null; + bitmaps[1].recycle(); + bitmaps[1] = null; } public boolean finished() |