RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 405 forks source link

Taping to focus on point after having stopped the camera which crash #185

Closed Diolor closed 6 years ago

Diolor commented 6 years ago
FATAL EXCEPTION: pool-22-thread-1 Process: io.fotoapparat.sample, PID: 4653
        java.lang.RuntimeException: Camera is being used after Camera.release() was called
        at android.hardware.Camera.native_setParameters(Native Method)
        at android.hardware.Camera.setParameters(Camera.java:1945)
        at io.fotoapparat.hardware.CameraDevice.updateFocusingAreas(CameraDevice.kt:323)
        at io.fotoapparat.hardware.CameraDevice.setFocalPoint$suspendImpl(CameraDevice.kt:233)
        at io.fotoapparat.hardware.CameraDevice.setFocalPoint(Unknown Source:0)
        at io.fotoapparat.routine.focus.FocusOnPointRoutineKt$focusOnPoint$1.doResume(FocusOnPointRoutine.kt:14)
        at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
        at kotlinx.coroutines.experimental.DispatchTask.run(CoroutineDispatcher.kt:129)
        at kotlinx.coroutines.experimental.EventLoopBase.processNextEvent(EventLoop.kt:147)
        at kotlinx.coroutines.experimental.BlockingCoroutine.joinBlocking(Builders.kt:236)
        at kotlinx.coroutines.experimental.BuildersKt.runBlocking(Builders.kt:174)
        at kotlinx.coroutines.experimental.BuildersKt.runBlocking$default(Builders.kt:167)
        at io.fotoapparat.routine.focus.FocusOnPointRoutineKt.focusOnPoint(FocusOnPointRoutine.kt:11)
        at io.fotoapparat.routine.camera.StartRoutineKt$start$2$1.run(StartRoutine.kt:63)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

We should unassign the on tap listener when stoping camera