From aff3548407c33a446cc4e8cd1fcf158335c05ab5 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Wed, 15 Aug 2007 19:40:41 +0000 Subject: [PATCH] Should fix #521 - no more "can not wait for thread termination" / "couldn't terminate thread" errors. Originally committed to SVN as r1491. --- aegisub/audio_player_dsound.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aegisub/audio_player_dsound.cpp b/aegisub/audio_player_dsound.cpp index 98f3ddd22..16efe7c64 100644 --- a/aegisub/audio_player_dsound.cpp +++ b/aegisub/audio_player_dsound.cpp @@ -362,8 +362,10 @@ void DirectSoundPlayer::Play(__int64 start,__int64 count) { void DirectSoundPlayer::Stop(bool timerToo) { // Stop the thread if (thread) { - thread->Stop(); - thread->Wait(); + if (thread->IsAlive()) { + thread->Stop(); + thread->Wait(); + } thread = NULL; } // The thread is now guaranteed dead and there are no concurrency problems to worry about