From e77211c6367e2ad3b7f6189eb6592a28ac2735b8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 18 Dec 2020 19:14:24 +1000 Subject: [PATCH] leave iodevice alone after calling .stop() Docs say it should not be accessed, and it fails on Linux. --- qt/aqt/sound.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 0ba978d27..889353e7d 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -604,16 +604,14 @@ class QtAudioInputRecorder(Recorder): self._buffer += self._iodevice.readAll() def stop(self, on_done: Callable[[str], None]): + # read anything remaining in buffer & stop + self._on_read_ready() self._audio_input.stop() if err := self._audio_input.error(): showWarning(f"recording failed: {err}") return - # read anything remaining in buffer & close - self._on_read_ready() - self._iodevice.close() - # swallow the first 300ms to allow audio device to quiesce wait = int(44100 * self.STARTUP_DELAY) if len(self._buffer) <= wait: