From 3eba29f85b7e187c37bb791307c4a1b0e94caa27 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Thu, 23 Jul 2026 11:17:41 +0200 Subject: [PATCH 1/4] fix: save processor data before destroying it when stopping inference during recording When the user clicks "Stop pose inference" before "Stop recording", the processor instance was destroyed by reset() without saving its accumulated data. Later the recording stop flow would find no processor instance and silently skip the save. Now _stop_inference() saves processor data first if recording is still active, so data is preserved regardless of stop-button order. --- dlclivegui/gui/main_window.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index c0c83ee8..df98bc32 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2364,6 +2364,10 @@ def _start_inference(self) -> None: def _stop_inference(self, show_message: bool = True) -> None: was_active = self._dlc_active + + if self._rec_manager.is_active: + self._save_processor_data_if_available() + self._dlc_active = False self._dlc_initialized = False self._dlc.reset() From 6ba98a4dc4475d2a220021e4b79d519bca407b99 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Thu, 23 Jul 2026 18:39:16 +0200 Subject: [PATCH 2/4] revert 3eba29f85b7e187c37bb791307c4a1b0e94caa27 partial save for crash path should not be called when stopping inference. --- dlclivegui/gui/main_window.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index df98bc32..c0c83ee8 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2364,10 +2364,6 @@ def _start_inference(self) -> None: def _stop_inference(self, show_message: bool = True) -> None: was_active = self._dlc_active - - if self._rec_manager.is_active: - self._save_processor_data_if_available() - self._dlc_active = False self._dlc_initialized = False self._dlc.reset() From b0992804818cb3bb8d101215803a7fbce1608c7e Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Thu, 23 Jul 2026 18:41:10 +0200 Subject: [PATCH 3/4] fix dlc_processor: clean up custom processor during DLC shutdown `shutdown()` was skipping `_cleanup_processor()` when the worker thread stopped cleanly, leaving the custom processor's resources unreleased and its buffered data unsaved. This commit adds the missing `_cleanup_processor()` call before tearing down the DLCLive instance. --- dlclivegui/services/dlc_processor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dlclivegui/services/dlc_processor.py b/dlclivegui/services/dlc_processor.py index 71a278ed..b2cb41f1 100644 --- a/dlclivegui/services/dlc_processor.py +++ b/dlclivegui/services/dlc_processor.py @@ -277,6 +277,7 @@ def shutdown(self) -> None: "Shutdown requested but worker thread is still alive; DLCLive instance may not be fully released." ) return + self._cleanup_processor() self._dlc = None self._initialized = False From 3626afd76c36ad9bdaac301d13f3ae726d532c3f Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Thu, 23 Jul 2026 18:55:07 +0200 Subject: [PATCH 4/4] warn: confirm before stopping inference while recording Stopping the DLC processor during a recording skips the processor's `on_recording_stopped` hook, which would normally handle legacy output copies and DB-compatible file alignment. Show a confirmation dialog when the user attempts to stop inference while recording is still active, recommending they stop recording first. --- dlclivegui/gui/main_window.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index c0c83ee8..0efd744b 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2363,6 +2363,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 any currently running DLC-processor. \n" + "File saving will not be handled via standard stop-recording hook." + "The processor might still save it's own data now, but this 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