diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp b/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp index d9b2a8a3f1..adc0d77bd6 100644 --- a/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp +++ b/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp @@ -428,7 +428,9 @@ int SimulatorWin::run() updateWindowTitle(); // startup message loop - return app->run(); + int ret = app->run(); + CC_SAFE_DELETE(_app); + return ret; } // services diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/main.cpp b/tools/simulator/frameworks/runtime-src/proj.win32/main.cpp index 09468bbf24..e034aa1575 100755 --- a/tools/simulator/frameworks/runtime-src/proj.win32/main.cpp +++ b/tools/simulator/frameworks/runtime-src/proj.win32/main.cpp @@ -9,8 +9,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); - auto simulator = SimulatorWin::getInstance(); - int ret = simulator->run(); - delete simulator; - return ret; + return SimulatorWin::getInstance()->run(); }