Merge pull request #3698 from minggo/develop

make Director::end() reantrant
This commit is contained in:
minggo 2013-09-18 08:58:44 -07:00
commit fa71f8f479
4 changed files with 23 additions and 10 deletions

View File

@ -704,8 +704,11 @@ void Director::purgeDirector()
CHECK_GL_ERROR_DEBUG();
// OpenGL view
_openGLView->end();
_openGLView = nullptr;
if (_openGLView)
{
_openGLView->end();
_openGLView = nullptr;
}
// delete Director
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];
}
void km_mat4_stack_release(km_mat4_stack* stack) {
free(stack->stack);
void km_mat4_stack_release(km_mat4_stack* stack)
{
if (stack->stack)
{
free(stack->stack);
stack->stack = NULL;
}
stack->top = NULL;
stack->item_count = 0;
stack->capacity = 0;

View File

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

View File

@ -89,12 +89,15 @@ TextureCache::~TextureCache()
void TextureCache::destroyInstance()
{
// notify sub thread to quick
_sharedTextureCache->_needQuit = true;
_sharedTextureCache->_sleepCondition.notify_one();
if (_sharedTextureCache->_loadingThread) _sharedTextureCache->_loadingThread->join();
CC_SAFE_RELEASE_NULL(_sharedTextureCache);
if (_sharedTextureCache)
{
// notify sub thread to quick
_sharedTextureCache->_needQuit = true;
_sharedTextureCache->_sleepCondition.notify_one();
if (_sharedTextureCache->_loadingThread) _sharedTextureCache->_loadingThread->join();
CC_SAFE_RELEASE_NULL(_sharedTextureCache);
}
}
const char* TextureCache::description() const