From 63f54cb5f7d6fdf0833c51619d5bb6b2b0b362fa Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 17 Apr 2014 10:15:11 +0800 Subject: [PATCH 1/2] closed #4568: Application crashes on closing if CC_ENABLE_CACHE_TEXTURE_DATA is enabled. CC_SAFE_RELEASE(_eventDispatcher); should be after 'delete _renderer;' in Director's destructor. --- cocos/2d/CCDirector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCDirector.cpp b/cocos/2d/CCDirector.cpp index e7ccbd72aa..296865cd6b 100644 --- a/cocos/2d/CCDirector.cpp +++ b/cocos/2d/CCDirector.cpp @@ -176,7 +176,7 @@ Director::~Director(void) CC_SAFE_RELEASE(_notificationNode); CC_SAFE_RELEASE(_scheduler); CC_SAFE_RELEASE(_actionManager); - CC_SAFE_RELEASE(_eventDispatcher); + delete _eventAfterUpdate; delete _eventAfterDraw; @@ -189,6 +189,8 @@ Director::~Director(void) delete _console; #endif + CC_SAFE_RELEASE(_eventDispatcher); + // clean auto release pool PoolManager::destroyInstance(); From 30e1d41dbf6bc59efe257be025f9d8819b74a53b Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 17 Apr 2014 10:16:37 +0800 Subject: [PATCH 2/2] Makes 'compareRenderCommand' as a static function instead of a global function --- cocos/2d/renderer/CCRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/renderer/CCRenderer.cpp b/cocos/2d/renderer/CCRenderer.cpp index 0a54dcbd72..e0b49f8aee 100644 --- a/cocos/2d/renderer/CCRenderer.cpp +++ b/cocos/2d/renderer/CCRenderer.cpp @@ -43,7 +43,7 @@ NS_CC_BEGIN // helper -bool compareRenderCommand(RenderCommand* a, RenderCommand* b) +static bool compareRenderCommand(RenderCommand* a, RenderCommand* b) { return a->getGlobalOrder() < b->getGlobalOrder(); }