diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm index 0a04d97885..c692779e80 100755 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm @@ -452,6 +452,7 @@ static void glfwDropFunc(GLFWwindow *window, int count, const char **files) RuntimeEngine::getInstance()->setProjectConfig(_project); Application::getInstance()->run(); + CC_SAFE_DELETE(_app); // After run, application needs to be terminated immediately. [NSApp terminate: self]; } @@ -705,6 +706,7 @@ static void glfwDropFunc(GLFWwindow *window, int count, const char **files) -(IBAction)onFileClose:(id)sender { + CC_SAFE_DELETE(_app); [[NSApplication sharedApplication] terminate:self]; }