diff --git a/app/src/main/java/com/quillstudios/pokegoalshelper/ScreenCaptureService.kt b/app/src/main/java/com/quillstudios/pokegoalshelper/ScreenCaptureService.kt index a11fe67..fff0f3a 100644 --- a/app/src/main/java/com/quillstudios/pokegoalshelper/ScreenCaptureService.kt +++ b/app/src/main/java/com/quillstudios/pokegoalshelper/ScreenCaptureService.kt @@ -1254,7 +1254,18 @@ class ScreenCaptureService : Service() { enhancedFloatingFAB?.hide() detectionController.clearUICallbacks() yoloDetector?.release() + // Proper executor shutdown with timeout ocrExecutor.shutdown() + try { + if (!ocrExecutor.awaitTermination(5, TimeUnit.SECONDS)) { + Log.w(TAG, "OCR executor did not terminate gracefully, forcing shutdown") + ocrExecutor.shutdownNow() + } + } catch (e: InterruptedException) { + Log.w(TAG, "Interrupted while waiting for OCR executor termination") + ocrExecutor.shutdownNow() + Thread.currentThread().interrupt() + } stopScreenCapture() } } \ No newline at end of file