Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Exiting yields an exception (reading 0xFEEEFEEE)  (Read 1926 times)

0 Members and 2 Guests are viewing this topic.

Waschmaschine

  • Newbie
  • *
  • Posts: 2
    • View Profile
Exiting yields an exception (reading 0xFEEEFEEE)
« on: May 21, 2015, 12:58:13 am »
Hey,
I've been trying to load some sf::SoundBuffers from memory in a SoundManager class to be used with sf::Sounds, which works perfectly. I am using MSVS12 (incl. toolset) and SFML2.1, I even doublechecked the DLLs.

 But when I close the game I get an error:
First-chance exception at 0x7651A4B9 (ole32.dll) in Game.exe: 0xC0000005: Access violation reading location 0xFEEEFEEE.
Unhandled exception at 0x7651A4B9 (ole32.dll) in Game.exe: 0xC0000005: Access violation reading location 0xFEEEFEEE.

Here's my code:
std::vector<sf::SoundBuffer*>   _soundBuffers;
A vector to contain the buffers, member of SoundManager.
SoundManager::~SoundManager(){
        for (int i = 0; i < SND_SIZE; ++i){
                delete _soundBuffers[i];
        }
}

void SoundManager::loadAll(){
        for (int i = 0; i < SND_SIZE; ++i){
                _soundBuffers.push_back( new sf::SoundBuffer() );
        }
}
loadAll() gets called exactly once at the start. I do not use any more lines from SFML.
I think it might be related to this:
https://github.com/SFML/SFML/issues/447
Any advice?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Exiting yields an exception (reading 0xFEEEFEEE)
« Reply #1 on: May 21, 2015, 01:42:33 pm »
Use SFML 2.3. As you see in issue #30, it has been fixed meanwhile.

By the way, you should avoid using new and delete. A simple std::vector<sf::SoundBuffer> should do the job. If you need pointers, use std::vector<std::unique_ptr<sf::SoundBuffer>>, it will automatically deallocate memory.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Waschmaschine

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Exiting yields an exception (reading 0xFEEEFEEE)
« Reply #2 on: May 24, 2015, 02:08:14 pm »
Use SFML 2.3. As you see in issue #30, it has been fixed meanwhile.

By the way, you should avoid using new and delete. A simple std::vector<sf::SoundBuffer> should do the job. If you need pointers, use std::vector<std::unique_ptr<sf::SoundBuffer>>, it will automatically deallocate memory.

Thank you, Nexus!

 

anything