Ensure after is called inside the daemon thread for players.

This commit is contained in:
Rapptz 2017-02-14 00:57:30 -05:00
parent 6166cbc2e7
commit 132ac45010

View File

@ -118,9 +118,10 @@ class StreamPlayer(threading.Thread):
except Exception as e:
self._current_error = e
self.stop()
finally:
self._call_after()
def stop(self):
self._end.set()
def _call_after(self):
if self.after is not None:
try:
arg_count = len(inspect.signature(self.after).parameters)
@ -136,6 +137,9 @@ class StreamPlayer(threading.Thread):
except:
pass
def stop(self):
self._end.set()
@property
def error(self):
return self._current_error