From cebcce4a349177f03ad1ef17bbb4342d1b9b985d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 25 Mar 2012 00:32:59 +0900 Subject: [PATCH] race condition in sound code --- anki/sound.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/anki/sound.py b/anki/sound.py index 2e6e47cc5..5036b6c14 100644 --- a/anki/sound.py +++ b/anki/sound.py @@ -97,7 +97,11 @@ class MplayerMonitor(threading.Thread): if not self.mplayer: self.startProcess() # pop a file - item = mplayerQueue.pop(0) + try: + item = mplayerQueue.pop(0) + except IndexError: + # queue was cleared by main thread + continue if mplayerClear: mplayerClear = False extra = ""