diff --git a/cocos2dx/textures/CCTextureCache.cpp b/cocos2dx/textures/CCTextureCache.cpp index 4dbfc57cbd..46d6e12047 100644 --- a/cocos2dx/textures/CCTextureCache.cpp +++ b/cocos2dx/textures/CCTextureCache.cpp @@ -469,7 +469,6 @@ CCTexture2D * CCTextureCache::addPVRImage(const char* path) return tex; } - CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key) { CCAssert(image != NULL, "TextureCache: image MUST not be nill"); @@ -482,6 +481,9 @@ CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key) forKey = CCFileUtils::fullPathFromRelativePath(key); } + // Don't have to lock here, because addImageAsync() will not + // invoke opengl function in loading thread. + do { // If key is nil, then create a new texture each time