Merge pull request #5283 from seemk/director_cleanup_fix

closed #4099: Fixed crashing when calling CCDirector's end() on win32.
This commit is contained in:
James Chen 2014-02-24 16:58:34 +08:00
commit 1b91234325
2 changed files with 11 additions and 7 deletions

View File

@ -486,7 +486,11 @@ bool GLView::isOpenGLReady()
void GLView::end()
{
if(_mainWindow)
{
glfwSetWindowShouldClose(_mainWindow,1);
_mainWindow = nullptr;
}
}
void GLView::swapBuffers()

View File

@ -94,13 +94,13 @@ int Application::run()
}
}
/* Only work on Desktop
* Director::mainLoop is really one frame logic
* when we want to close the window, we should call Director::end();
* then call Director::mainLoop to do release of internal resources
*/
director->end();
director->mainLoop();
// Director should still do a cleanup if the window was closed manually.
if (glview->isOpenGLReady())
{
director->end();
director->mainLoop();
director = nullptr;
}
return true;
}