SL-17547 Fix for crash in getCurrentDiscardLevelForFetching (and add runtime check and assertion to avoid crash in production and detect crash in development).

meow-7.2.2
Dave Parks 2022-06-07 15:12:58 -05:00
parent 5259fa811c
commit 197baebc62
3 changed files with 28 additions and 16 deletions

View File

@ -1071,7 +1071,7 @@ void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size)
// Locks: Mw
void LLTextureFetchWorker::setImagePriority(F32 priority)
{
mImagePriority = priority; //should map to max virtual size
mImagePriority = priority; //should map to max virtual size, abort if zero
}
// Locks: Mw
@ -1397,7 +1397,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
else
{
// Shouldn't need to do anything here
llassert(mFetcher->mNetworkQueue.find(mID) != mFetcher->mNetworkQueue.end());
//llassert(mFetcher->mNetworkQueue.find(mID) != mFetcher->mNetworkQueue.end());
return false;
}
}
@ -3011,16 +3011,18 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority)
{
LL_PROFILE_ZONE_SCOPED;
bool res = false;
LLTextureFetchWorker* worker = getWorker(id);
if (worker)
{
worker->lockWorkMutex(); // +Mw
worker->setImagePriority(priority);
worker->unlockWorkMutex(); // -Mw
res = true;
}
return res;
mRequestQueue.post([=]()
{
LLTextureFetchWorker* worker = getWorker(id);
if (worker)
{
worker->lockWorkMutex(); // +Mw
worker->setImagePriority(priority);
worker->unlockWorkMutex(); // -Mw
}
});
return true;
}
// Replicates and expands upon the base class's

View File

@ -653,6 +653,8 @@ void LLViewerTexture::cleanup()
{
notifyAboutMissingAsset();
LLAppViewer::getTextureFetch()->updateRequestPriority(mID, 0.f);
mFaceList[LLRender::DIFFUSE_MAP].clear();
mFaceList[LLRender::NORMAL_MAP].clear();
mFaceList[LLRender::SPECULAR_MAP].clear();
@ -1941,6 +1943,11 @@ bool LLViewerFetchedTexture::updateFetch()
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - in fast cache");
return false;
}
if (mGLTexturep.isNull())
{ // fix for crash inside getCurrentDiscardLevelForFetching (shouldn't happen but appears to be happening)
llassert(false);
return false;
}
S32 current_discard = getCurrentDiscardLevelForFetching();
S32 desired_discard = getDesiredDiscardLevel();

View File

@ -1025,7 +1025,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
LLTimer image_op_timer;
typedef std::vector<LLViewerFetchedTexture*> entries_list_t;
typedef std::vector<LLPointer<LLViewerFetchedTexture> > entries_list_t;
entries_list_t entries;
// update N textures at beginning of mImageList
@ -1057,10 +1057,13 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
}
}
for (auto* imagep : entries)
for (auto& imagep : entries)
{
updateImageDecodePriority(imagep);
imagep->updateFetch();
if (imagep->getNumRefs() > 1) // make sure this image hasn't been deleted before attempting to update (may happen as a side effect of some other image updating)
{
updateImageDecodePriority(imagep);
imagep->updateFetch();
}
}
if (entries.size() > 0)