Fail to destruct used SoundBuffer also in release builds
This commit is contained in:
parent
635c8c9290
commit
282dedd0d5
@ -35,11 +35,10 @@
|
|||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <SFML/System/Time.hpp>
|
#include <SFML/System/Time.hpp>
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +69,12 @@ SoundBuffer::SoundBuffer(const SoundBuffer& copy) : m_samples(copy.m_samples), m
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SoundBuffer::~SoundBuffer()
|
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
|
// Destroy the buffer
|
||||||
if (m_buffer)
|
if (m_buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user