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

Author Topic: Unhandled Exception when exiting program a Sound object was declared in  (Read 2242 times)

0 Members and 1 Guest are viewing this topic.

Pindrought

  • Newbie
  • *
  • Posts: 11
    • View Profile
Does anyone know if this is expected behavior or am I doing something wrong before leaving the scope?

Here is the code i'm using
Code: [Select]
#include <SFML/Audio.hpp>
#include "SFML/Config.hpp"
#include <Windows.h>
#include <iostream>
#include <string>

int main()
{
sf::SoundBuffer Example;
return 0;
}


Here's an image of the exception I get after the function returns once I exit the program. Is there something I should be doing to stop this from happening or is this expected behavior? Also note that I tested this with other objects such as the sf::Sound, sf::SoundBufferRecorder and even more and they all caused the same exception to occur once I exit the program. It is odd to me since I am under the assumption that it is not the destructor causing the issue since the following code does not cause an exception after the scope of the ExampleFunc() function is left. It only causes the exception once the program ends.
Code: [Select]
#include <SFML/Audio.hpp>
#include "SFML/Config.hpp"
#include <Windows.h>
#include <iostream>
#include <string>

void ExampleFunc()
{
sf::SoundBufferRecorder Example;
}

int main()
{
ExampleFunc(); //This executes fine
return 0; //After returning, once the program ends I get the exception
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10835
    • View Profile
    • development blog
    • Email
AW: Unhandled Exception when exiting scope a Sound object was declared in
« Reply #1 on: February 19, 2015, 01:13:38 pm »
What version of SFML do you use?
Does it also crash without any SFML classes?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Pindrought

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Unhandled Exception when exiting program a Sound object was declared in
« Reply #2 on: February 19, 2015, 01:25:26 pm »
I just upgraded to SFML 2.2, but I had this issue with other versions of SFML also. In the release executable, the exception doesn't pop up as it's just an exception message from debugging, but I didn't know if this was something I should be trying to avoid or not. If I don't use any Sound related classes, I get no exception issues.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10835
    • View Profile
    • development blog
    • Email
Re: Unhandled Exception when exiting program a Sound object was declared in
« Reply #3 on: February 19, 2015, 02:33:19 pm »
Btw. the forum has [code=cpp][/code] tags. ;)

0xFEEFEE means that freed heap memory is being accessed. As such something seems to try to access memory which has already been freed.
Could you break into the debugger and provide the call stack?

Also you might want to try the latest source from GitHub, there's been at least one fix for OpenAL.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Pindrought

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Unhandled Exception when exiting program a Sound object was declared in
« Reply #4 on: February 19, 2015, 02:41:24 pm »
Is this what you wanted me to upload?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10835
    • View Profile
    • development blog
    • Email
Re: Unhandled Exception when exiting program a Sound object was declared in
« Reply #5 on: February 19, 2015, 02:57:31 pm »
Yep, so yeah it might be related to the OpenAL issue that should already be fix in Git. Either build from the latest Git source or wait for the next SFML release.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/