From 8d18f4c42a9a13d551fc0328dc82c4a0cfda752d 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 b59e5bde..3fcc8471 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2504,6 +2504,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 7b6f7ac23e381f91526733cc032a466debc944ef 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 3fcc8471..b59e5bde 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2504,10 +2504,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 d0e38e813a52bf0e05f030557c23b766b8dbb5ec 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/dlclivegui/services/dlc_processor.py b/dlclivegui/services/dlc_processor.py index e51be750..7cdf9c46 100644 --- a/dlclivegui/services/dlc_processor.py +++ b/dlclivegui/services/dlc_processor.py @@ -283,6 +283,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 be48beeb55097ddfb8959676b2f65af4f07bdb48 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 b59e5bde..b4a43dfe 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2503,6 +2503,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 7c7a7d23715ae09760d15336302ffefaddbda390 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 b4a43dfe..5b9bcf38 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2507,7 +2507,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 91c2afc252fb32d160ba5e397ce0c7c10db953b6 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 5b9bcf38..b60f29fa 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2508,8 +2508,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 c505db2171b34b64d865707cdca5696d4ee8f308 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 b60f29fa..8c771d51 100644 --- a/dlclivegui/gui/main_window.py +++ b/dlclivegui/gui/main_window.py @@ -2507,9 +2507,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: