I'm using the latest snapshot of SFML2. After some coding my program started crashing when I would close the rendering window, after much confusion and frustration I've narrowed it down to this.
With the code below my application will run fine until I close the rendering window (then it crashes).
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::Font font;
if (!font.LoadFromFile("res\\font\\white_rabbit.ttf"))
return EXIT_FAILURE;
sf::Text text;
text.SetString("test");
text.SetFont(font);
text.SetCharacterSize(50);
//sf::Text text("Hello SFML", font, 50);
while (window.IsOpen())
{
sf::Event event;
while (window.PollEvent(event))
{
if (event.Type == sf::Event::Closed)
window.Close();
}
window.Clear(sf::Color(0, 0, 0));
window.Draw(text);
window.Display();
}
return EXIT_SUCCESS;
}
However if I change the code to use
sf::Text text("Hello SFML", font, 50);
instead. My application runs fine and doesn't crash upon closing the rendering window.
edit: Seems to work fine on linux...
Windows 7 64b
Visual Studio 2010 Express
Intel® Core™ i5 CPU M 450 @ 2.40GHz × 4
Memory: 3.7 GiB
Some ATI videocard