make Director::end() reantrant

This commit is contained in:
minggo 2013-09-18 23:52:09 +08:00
parent 339b4fa749
commit a901efb603
4 changed files with 23 additions and 10 deletions

View File

@ -704,8 +704,11 @@ void Director::purgeDirector()
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
// OpenGL view // OpenGL view
if (_openGLView)
{
_openGLView->end(); _openGLView->end();
_openGLView = nullptr; _openGLView = nullptr;
}
// delete Director // delete Director
release(); release();

View File

@ -66,8 +66,14 @@ void km_mat4_stack_pop(km_mat4_stack* stack, kmMat4* pOut)
stack->top = &stack->stack[stack->item_count - 1]; stack->top = &stack->stack[stack->item_count - 1];
} }
void km_mat4_stack_release(km_mat4_stack* stack) { void km_mat4_stack_release(km_mat4_stack* stack)
{
if (stack->stack)
{
free(stack->stack); free(stack->stack);
stack->stack = NULL;
}
stack->top = NULL; stack->top = NULL;
stack->item_count = 0; stack->item_count = 0;
stack->capacity = 0; stack->capacity = 0;

View File

@ -503,6 +503,7 @@ UserDefault* UserDefault::getInstance()
void UserDefault::destroyInstance() void UserDefault::destroyInstance()
{ {
delete _userDefault;
_userDefault = NULL; _userDefault = NULL;
} }

View File

@ -88,6 +88,8 @@ TextureCache::~TextureCache()
} }
void TextureCache::destroyInstance() void TextureCache::destroyInstance()
{
if (_sharedTextureCache)
{ {
// notify sub thread to quick // notify sub thread to quick
_sharedTextureCache->_needQuit = true; _sharedTextureCache->_needQuit = true;
@ -96,6 +98,7 @@ void TextureCache::destroyInstance()
CC_SAFE_RELEASE_NULL(_sharedTextureCache); CC_SAFE_RELEASE_NULL(_sharedTextureCache);
} }
}
const char* TextureCache::description() const const char* TextureCache::description() const
{ {