diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index 51bce9932..616672f96 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -35,11 +35,10 @@ #include #include +#include #include #include -#include - #if defined(__APPLE__) #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -70,7 +69,12 @@ SoundBuffer::SoundBuffer(const SoundBuffer& copy) : m_samples(copy.m_samples), m //////////////////////////////////////////////////////////// SoundBuffer::~SoundBuffer() { - assert(m_sounds.empty() && "sf::SoundBuffer must not be destructed while it is used by a sf::Sound"); + // Make sure no sound is attached to this buffer + if (!m_sounds.empty()) + { + err() << "Failed to destruct sound buffer because it is used by " << m_sounds.size() << " sound(s)" << std::endl; + std::terminate(); + } // Destroy the buffer if (m_buffer)