1
Audio / [SOLVED] Problem with Singletons
« on: May 09, 2023, 12:06:30 am »
There is some problem if I call the destructor of a sf::SoundBuffer before it reaches the normal end of scope!? because I am using a singleton class to store global sounds that can be used for any class in the application, but, the aplication is big enough to require a more smart loading instead load everything at the beginning of the application.
Every time I free those sound buffers by just removing its unique_ptr from a map, when the application reaches the end I've got: 'malloc(): unsorted double linked list corrupted', maybe there is some restriction because the sf::SoundFileFactory that keeps some global info, that will properly RAII at the end of application only!?
For instance, I've only loaded the buffers and freed them. I did not create any sf::Sound or play it, just loaded and freed it by removing the unique_ptr from the map using its 'key' on the 'erase' method.
Every time I free those sound buffers by just removing its unique_ptr from a map, when the application reaches the end I've got: 'malloc(): unsorted double linked list corrupted', maybe there is some restriction because the sf::SoundFileFactory that keeps some global info, that will properly RAII at the end of application only!?
For instance, I've only loaded the buffers and freed them. I did not create any sf::Sound or play it, just loaded and freed it by removing the unique_ptr from the map using its 'key' on the 'erase' method.