I run into this, and found out how to solve it. It was quite simple, actually.
I was doing this:
while (window.IsOpened())
{
sf::Event event;
while(window.GetEvent(event))
{
// Window-broad event handling.
if (event.Type == sf::Event::Closed) window.Close();
// [More event handling]
}
// [OpenGL Rendering]
window.Display();
}
Now, I am doing this instead:
while (window.IsOpened())
{
// [OpenGL Rendering]
window.Display();
sf::Event event;
while(window.GetEvent(event))
{
// Window-broad event handling.
if (event.Type == sf::Event::Closed) { window.Close(); break; }
// [More event handling]
}
}
Before, I was closing the window and later calling window.Display(), which I guess was triggering the error. Now, upon close action on the user side, I close the window, break the event handling (any additional event will not matter since the application is being closed), and since the event handling is now at the end of the loop, there is no further call to window.Display().
Now the output is clean when leaving the application