From f24107368fa47f911f4491f644ff3755525c91e1 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 19 Aug 2017 20:20:51 +0500 Subject: 2017-08-19 --- src/ThreadGame.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ThreadGame.cpp') diff --git a/src/ThreadGame.cpp b/src/ThreadGame.cpp index d3750ea..ef7a95e 100644 --- a/src/ThreadGame.cpp +++ b/src/ThreadGame.cpp @@ -19,13 +19,14 @@ void ThreadGame::Execute() { listener.RegisterHandler(EventType::ConnectionSuccessfull, [this](EventData eventData) { auto data = std::get(eventData); - gs = new GameState(data.ptr); + gs = std::make_shared(data.ptr); + gs->gs = gs; }); listener.RegisterHandler(EventType::Disconnected, [this](EventData eventData) { std::this_thread::sleep_for(std::chrono::milliseconds(500)); - delete gs; - gs = nullptr; + gs->gs.reset(); + gs.reset(); }); listener.RegisterHandler(EventType::KeyPressed, [this](EventData eventData) { @@ -100,5 +101,5 @@ void ThreadGame::Execute() { } timer.Update(); } - delete gs; + gs.reset(); } -- cgit v1.2.3