From f3317ad4eedac34f16f19a4b10c6e7199fd1f889 Mon Sep 17 00:00:00 2001 From: Andrew Munn Date: Wed, 1 Nov 2017 13:29:50 -0700 Subject: [PATCH] Remove UncaughtExceptionHandler from CameraController in stopImmediately (#92) * Fixes #90 Remove UncaughtExceptionHandler from CameraController in stopImmediately * Move setUncaughtExceptionHandler(null) before onStop() --- .../java/com/otaliastudios/cameraview/CameraController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java index cad2eeba..cde43096 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java @@ -144,6 +144,8 @@ abstract class CameraController implements CameraPreview.SurfaceCallback { // Don't check, try stop again. LOG.i("Stop immediately. State was:", ss()); mState = STATE_STOPPING; + // Prevent leaking CameraController. + mHandler.getThread().setUncaughtExceptionHandler(null); onStop(); mState = STATE_STOPPED; LOG.i("Stop immediately. Stopped. State is:", ss());