From ab10cdf9444e745fbdafab991322f61660f6353c Mon Sep 17 00:00:00 2001 From: pythonengineer <16440418+pythonengineer@users.noreply.github.com> Date: Sun, 12 May 2024 22:42:34 -0400 Subject: [PATCH] Backport media thread join exception catch from 2.0 (9db3971) (#1105) --- pyglet/media/mediathreads.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyglet/media/mediathreads.py b/pyglet/media/mediathreads.py index 08a2c618b..e5112d057 100644 --- a/pyglet/media/mediathreads.py +++ b/pyglet/media/mediathreads.py @@ -91,7 +91,11 @@ def stop(self): with self._condition: self._stopped = True self._condition.notify() - self._thread.join() + try: + self._thread.join() + except RuntimeError: + # Ignore on unclean shutdown + pass def sleep(self, timeout): """Wait for some amount of time, or until notified.