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

Author Topic: Rare behavior  (Read 4034 times)

0 Members and 1 Guest are viewing this topic.

orgos

  • Newbie
  • *
  • Posts: 27
    • View Profile
Rare behavior
« on: August 27, 2010, 03:03:27 pm »
Hi.

Making some test with SFML 2 we found some rare behavior using soundbuffer.

When we make a soundbuffer declaration the program not return 0 at the end, it return some negative number.

Just making this:

Code: [Select]

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   
    sf::SoundBuffer mySound;

    // Start game loop
    while (App.IsOpened())
    {

        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}



I test it on Windows XP Sp3 32bits, Windows 7 32bits, using Codeblock and GCC compiler.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Rare behavior
« Reply #1 on: August 27, 2010, 03:26:10 pm »
Does it crash? Or does it always ends when you close the window?
Laurent Gomila - SFML developer

orgos

  • Newbie
  • *
  • Posts: 27
    • View Profile
Rare behavior
« Reply #2 on: August 27, 2010, 03:35:59 pm »
It does when I normal close the window.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Rare behavior
« Reply #3 on: August 27, 2010, 03:59:40 pm »
So what's the problem? Just ignore the return value :D
Laurent Gomila - SFML developer

orgos

  • Newbie
  • *
  • Posts: 27
    • View Profile
Rare behavior
« Reply #4 on: August 27, 2010, 04:06:54 pm »
We think that can be a problem releasing some thing, so we decide to report it.

So its a normal behavior?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Rare behavior
« Reply #5 on: August 27, 2010, 04:23:25 pm »
No it isn't normal. If the return value is not 0, then obviously the application returns before the "return EXIT_SUCCESS" statement, which means that it crashes.

Have you tried running the debugger?
Laurent Gomila - SFML developer