Skip to content

Commit a8b1a6a

Browse files
committed
Handle force-stop with leftover camera threads
When a forced stop finds camera threads still running, also clear failed camera state, buffered frames and timestamps (under the frame lock), and reset expected cameras to 0. Add a critical log warning that background camera threads may still be active and emit all_stopped so the GUI can leave the running state; warn that an application restart may be required. This prevents stale state from blocking future starts while making the risk visible in logs.
1 parent dc579df commit a8b1a6a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

dlclivegui/services/multi_camera_controller.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,20 @@ def stop(self, wait: bool = True) -> None:
264264

265265
if still_running:
266266
self._started_cameras.clear()
267+
self._failed_cameras.clear()
268+
with self._frame_lock:
269+
self._frames.clear()
270+
self._timestamps.clear()
271+
self._expected_cameras = 0
272+
273+
LOGGER.critical(
274+
"Force stop failed for camera threads: %s."
275+
"Sending all_stopped to leave GUI in running state,"
276+
"but background camera threads may still be active and interfere with future camera starts."
277+
"Application restart may be required.",
278+
still_running,
279+
)
280+
self.all_stopped.emit()
267281
return
268282

269283
self._started_cameras.clear()

0 commit comments

Comments
 (0)