Add correct audio cleanup
In case application closes before spontaneous players are done playing,
first remove all references to the spontaneous players before deleting
the audio driver.
@@ -55,6 +55,13 @@ def get_audio_driver():
def _delete_audio_driver():
+ # First cleanup any remaining spontaneous Player
+ from .. import Source
+ for p in Source._players:
+ # Remove the reference to _on_player_eos which had a closure on the player
+ p.on_player_eos = None
+ del p
+ del Source._players
global _audio_driver
_audio_driver = None
