From 9c07a8b94b257ec7a13d32c178aff8b8237b6990 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/7] 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 7d3bc27a..97ef67b6 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2483,6 +2483,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(reset_processor_plugin=True) From 50048b5f309da8386fefe6d51198acc9bea27554 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/7] 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 97ef67b6..7d3bc27a 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2483,10 +2483,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(reset_processor_plugin=True) From 0d59b32d572fcb3686fb041b9eec6fabe285cd56 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/7] 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From 9571c2a35d41f3b21b40fd0e6bd72b8dcf1e1b83 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/7] 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 7d3bc27a..cd32e7f7 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2482,6 +2482,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 From bf8f402f240839d2ffe4293426b66f195c2ce8e1 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Mon, 10 Aug 2026 13:34:31 +0200 Subject: [PATCH 5/7] Update dlclivegui/gui/main_window.py Co-authored-by: Cyril Achard --- dlclivegui/gui/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index cd32e7f7..963b7c89 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2486,7 +2486,7 @@ def _stop_inference(self, show_message: bool = True) -> None: answer = QMessageBox.question( self, "Stop inference while recording?", - "This will stop any currently running DLC-processor. \n" + "This will stop currently running DLC-live custom 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?", From 8ad9d6f546c4e7b9a6ca0fe6126afc1fdee0af91 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Mon, 10 Aug 2026 13:34:41 +0200 Subject: [PATCH 6/7] Update dlclivegui/gui/main_window.py Co-authored-by: Cyril Achard --- dlclivegui/gui/main_window.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index 963b7c89..8084325a 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2487,8 +2487,8 @@ def _stop_inference(self, show_message: bool = True) -> None: self, "Stop inference while recording?", "This will stop currently running DLC-live custom 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" + "File saving will not be handled via the standard 'recording stopped' event hooks." + "The processor might still save data now, but this will not be paired with the recording.\n\n" "Stop inference anyway?", ) if answer != QMessageBox.Yes: From c9264f309f785179a6f91c20c99537f3213f849e Mon Sep 17 00:00:00 2001 From: Cyril Achard Date: Mon, 10 Aug 2026 16:09:47 +0200 Subject: [PATCH 7/7] Fix message when stopping inference while recording --- dlclivegui/gui/main_window.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlclivegui/gui/main_window.py b/dlclivegui/gui/main_window.py index 8084325a..19d92fb1 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2486,9 +2486,9 @@ def _stop_inference(self, show_message: bool = True) -> None: answer = QMessageBox.question( self, "Stop inference while recording?", - "This will stop currently running DLC-live custom processor. \n" + "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 this will not be paired with the recording.\n\n" + "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: