File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 3030import android .graphics .drawable .Drawable ;
3131import android .net .Uri ;
3232import android .os .AsyncTask ;
33+ import android .os .Build ;
3334import android .os .HandlerThread ;
3435import android .util .AttributeSet ;
3536import android .util .Log ;
@@ -154,7 +155,7 @@ enum ScrollDir {
154155 private DecodingAsyncTask decodingAsyncTask ;
155156
156157 /** The thread {@link #renderingHandler} will run on */
157- private final HandlerThread renderingHandlerThread ;
158+ private HandlerThread renderingHandlerThread ;
158159 /** Handler always waiting in the background and rendering tasks */
159160 RenderingHandler renderingHandler ;
160161
@@ -462,6 +463,14 @@ public void computeScroll() {
462463 @ Override
463464 protected void onDetachedFromWindow () {
464465 recycle ();
466+ if (renderingHandlerThread != null ) {
467+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .JELLY_BEAN_MR2 ) {
468+ renderingHandlerThread .quitSafely ();
469+ } else {
470+ renderingHandlerThread .quit ();
471+ }
472+ renderingHandlerThread = null ;
473+ }
465474 super .onDetachedFromWindow ();
466475 }
467476
You can’t perform that action at this time.
0 commit comments