diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index 6ed0f39c..ff6518e9 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2469,6 +2469,18 @@ def _start_inference(self) -> None: self._update_dlc_controls_enabled() def _stop_inference(self, show_message: bool = True) -> None: + if self._rec_manager.is_active: + answer = QMessageBox.question( + self, + "Stop inference while recording?", + "This will stop the currently running DLC-live custom processor, if any.\n" + "File saving will not be handled via the standard 'recording stopped' event hooks." + "The processor might still save data now, but it will not be paired with the recording.\n\n" + "Stop inference anyway?", + ) + if answer != QMessageBox.Yes: + return + was_active = self._dlc_active self._dlc_active = False self._dlc_initialized = False diff --git a/dlclivegui/services/dlc_processor.py b/dlclivegui/services/dlc_processor.py index 8bd6cc75..c2993d79 100644 --- a/dlclivegui/services/dlc_processor.py +++ b/dlclivegui/services/dlc_processor.py @@ -282,10 +282,10 @@ def shutdown(self) -> None: with self._lifecycle_lock: self._pending_reset = True self._pending_processor_cleanup = True - logger.warning( - "Shutdown requested but worker thread is still alive; DLCLive instance may not be fully released." - ) - return + logger.warning( + "Shutdown requested but worker thread is still alive; DLCLive instance may not be fully released." + ) + return self._cleanup_processor() self._dlc = None