cleanup recording on cancel

This commit is contained in:
Damien Elmes 2019-07-14 11:19:29 +10:00
parent 7a9508ea75
commit 95387af2cd
2 changed files with 6 additions and 2 deletions

View file

@ -334,13 +334,16 @@ class _Recorder:
except:
ret = True
finally:
if os.path.exists(processingSrc):
os.unlink(processingSrc)
self.cleanup()
if ret:
raise Exception(_(
"Error running %s") %
" ".join(cmd))
def cleanup(self):
if os.path.exists(processingSrc):
os.unlink(processingSrc)
class PyAudioThreadedRecorder(threading.Thread):
def __init__(self, startupDelay):

View file

@ -40,6 +40,7 @@ def getAudio(parent, encode=True):
QApplication.instance().processEvents()
if mb.clickedButton() == mb.escapeButton():
r.stop()
r.cleanup()
return
saveGeom(mb, "audioRecorder")
# ensure at least a second captured