From 57941c1696a7e4a6b0491e3b2adcb2a5f6e5f573 Mon Sep 17 00:00:00 2001 From: binary1248 Date: Sat, 5 Jul 2014 16:19:30 +0200 Subject: [PATCH] Fixed invoking a virtual method (onSeek) in the destructor of SoundStream. --- src/SFML/Audio/SoundStream.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index 1c37d3ee5..eb84f25f0 100644 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp @@ -59,7 +59,15 @@ m_samplesProcessed(0) SoundStream::~SoundStream() { // Stop the sound if it was playing - stop(); + + // Request the thread to terminate + { + Lock lock(m_threadMutex); + m_isStreaming = false; + } + + // Wait for the thread to terminate + m_thread.wait(); }