Merge pull request #910 from dumganhar/iss1253_purgeConfig

fixed #1253: Added static method "purgeConfiguration" for CCConfiguration to avoid memory leak.
This commit is contained in:
James Chen 2012-05-22 21:47:17 -07:00
commit aae5d881fc
3 changed files with 11 additions and 4 deletions

View File

@ -104,6 +104,11 @@ CCConfiguration* CCConfiguration::sharedConfiguration(void)
return s_gSharedConfiguration;
}
void CCConfiguration::purgeConfiguration(void)
{
CC_SAFE_RELEASE_NULL(s_gSharedConfiguration);
}
bool CCConfiguration::checkForGLExtension(const string &searchName)
{
bool bRet = false;

View File

@ -39,9 +39,10 @@ NS_CC_BEGIN
class CC_DLL CCConfiguration : public CCObject
{
public:
/** returns a shared instance of the CCConfiguration */
/** returns a shared instance of CCConfiguration */
static CCConfiguration *sharedConfiguration(void);
/** purge the shared instance of CCConfiguration */
static void purgeConfiguration(void);
public:
/** OpenGL Max texture size. */

View File

@ -583,10 +583,11 @@ void CCDirector::purgeDirector()
// purge all managers caches
CCAnimationCache::purgeSharedAnimationCache();
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
CCTextureCache::purgeSharedTextureCache();
CCShaderCache::purgeSharedShaderCache();
CCConfiguration::purgeConfiguration();
// cocos2d-x specific data structures
CCUserDefault::purgeSharedUserDefault();
extension::CCNotificationCenter::purgeNotificationCenter();