I am using cocos2dx-v3.17.2, ndk-r21d, android studio 4.1.1
. I am experiencing a crash on
cocos2d::TextureCache::loadImage() + 290
My crash stack trace from firebase crashlytics is like below image:
I don't use TextureCache::addImageAsync or TextureCache::addImage
method to preload textures. So I can't understand what is happening actually.
The cocos code is below:
void TextureCache::loadImage()
{
AsyncStruct *asyncStruct = nullptr;
while (!_needQuit)
{
std::unique_lock<std::mutex> ul(_requestMutex);
// pop an AsyncStruct from request queue
if (_requestQueue.empty())
{
asyncStruct = nullptr;
}
else
{
asyncStruct = _requestQueue.front();
_requestQueue.pop_front();
}
if (nullptr == asyncStruct) {
if (_needQuit) {
break;
}
_sleepCondition.wait(ul);
continue;
}
ul.unlock();
// load image
asyncStruct->loadSuccess = asyncStruct->image.initWithImageFileThreadSafe(asyncStruct->filename);
// ETC1 ALPHA supports.
if (asyncStruct->loadSuccess && asyncStruct->image.getFileType() == Image::Format::ETC && !s_etc1AlphaFileSuffix.empty())
{ // check whether alpha texture exists & load it
auto alphaFile = asyncStruct->filename + s_etc1AlphaFileSuffix;
if (FileUtils::getInstance()->isFileExist(alphaFile))
asyncStruct->imageAlpha.initWithImageFileThreadSafe(alphaFile);
}
// push the asyncStruct to response queue
_responseMutex.lock();
_responseQueue.push_back(asyncStruct);
_responseMutex.unlock();
}
}
Crash is occurring in the below line:
_sleepCondition.wait(ul);
Please help me. Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire