Okay on Windows built with vs 2015, with the image file being valid, the following throws on closing the window in 2.4.2 but not in 2.4.1. If you move the declaration of game into the main function it is fine.
#include <memory>
#include <Windows.h>
#include <SFML/Graphics.hpp>
class Scene
{
std::shared_ptr<sf::Texture> bkgd_tex_;
public:
Scene::Scene()
{
}
void Scene::setBackground(const std::shared_ptr<sf::Texture>& tex)
{
bkgd_tex_ = tex;
}
};
class Game
{
private:
std::unique_ptr<sf::RenderWindow> window_;
std::shared_ptr<Scene> active_scene_;
public:
Game() {
}
void initialize()
{
sf::VideoMode video_mode;
unsigned int style;
video_mode = sf::VideoMode(600, 600);
style = sf::Style::Titlebar | sf::Style::Close;
window_ = std::make_unique<sf::RenderWindow>(video_mode, "foo", style);
}
void run(const std::shared_ptr<Scene>& startingScene) {
active_scene_ = startingScene;
sf::Event event;
while (window_->isOpen()) {
while (window_->pollEvent(event)) {
if (event.type == sf::Event::EventType::Closed)
window_->close();
}
}
}
};
Game game;
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
game.initialize();
auto scene = std::make_shared<Scene>();
auto bkgd = std::make_shared<sf::Texture>();
bkgd->loadFromFile(".\\data\\escher_square.png");
scene->setBackground(bkgd);
game.run(scene);
return 0;
}