mirror of https://github.com/axmolengine/axmol.git
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:
commit
1b91234325
|
@ -486,7 +486,11 @@ bool GLView::isOpenGLReady()
|
|||
void GLView::end()
|
||||
{
|
||||
if(_mainWindow)
|
||||
{
|
||||
glfwSetWindowShouldClose(_mainWindow,1);
|
||||
_mainWindow = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GLView::swapBuffers()
|
||||
|
|
|
@ -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 should still do a cleanup if the window was closed manually.
|
||||
if (glview->isOpenGLReady())
|
||||
{
|
||||
director->end();
|
||||
director->mainLoop();
|
||||
director = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue