diff options
| author | Sam Scholten | 2025-10-14 16:53:18 +1000 |
|---|---|---|
| committer | Sam Scholten | 2025-10-14 16:53:48 +1000 |
| commit | 12bbb9025d4bff7caf04fa8e3c013196e81e2b40 (patch) | |
| tree | cee11df304761ec5d82908565e3f900d127d6fcc | |
| parent | 2c714a6803fa106dcf23f40f8a0e5876cbf16db4 (diff) | |
| download | picostream-12bbb9025d4bff7caf04fa8e3c013196e81e2b40.tar.gz picostream-12bbb9025d4bff7caf04fa8e3c013196e81e2b40.zip | |
fix GUI deadlock by making Streamer.run non-blocking
| -rw-r--r-- | picostream/cli.py | 10 | ||||
| -rw-r--r-- | picostream/main.py | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/picostream/cli.py b/picostream/cli.py index 23922e3..2006645 100644 --- a/picostream/cli.py +++ b/picostream/cli.py @@ -400,10 +400,12 @@ class Streamer: # We call shutdown() to ensure threads are joined and cleanup happens. self.shutdown() else: - # Original non-GUI behavior - self.consumer_thread.join() - self.pico_thread.join() - logger.success("Acquisition complete!") + # In GUI mode, run() returns immediately, allowing the worker's event + # loop to process signals. In CLI mode, we block until completion. + if not self.is_gui_mode: + self.consumer_thread.join() + self.pico_thread.join() + logger.success("Acquisition complete!") # --- Argument Parsing --- diff --git a/picostream/main.py b/picostream/main.py index 9fdb423..6617f12 100644 --- a/picostream/main.py +++ b/picostream/main.py @@ -47,7 +47,6 @@ class StreamerWorker(QObject): self.streamer.run() except Exception as e: self.error.emit(str(e)) - finally: self.finished.emit() @pyqtSlot() @@ -55,6 +54,7 @@ class StreamerWorker(QObject): """Signal the acquisition to stop.""" if self.streamer: self.streamer.shutdown() + self.finished.emit() class PicoStreamMainWindow(QMainWindow): |
