summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturefetch.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-08-13 21:28:58 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-08-14 21:49:53 +0300
commita3c380acd9256102730574afb261aa6266f9a2a5 (patch)
tree46e78495f6c2e0fa0135677ee1b9e45f4b413d7b /indra/newview/lltexturefetch.cpp
parent1d3edf3f8de6d456397f9008c15823b0112fea44 (diff)
#6135 Make sure texture worker cleanup is reliable
and that two threads won't race t delete same request
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r--indra/newview/lltexturefetch.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 144940c705..a0d7aac3f3 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -2527,18 +2527,26 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L
{
LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << " type " << f_type << LL_ENDL;
}
- LLTextureFetchWorker* worker = getWorker(id);
+
+ // Potentially we might remove a request, lock queue here instead
+ // of getWorker to make sure request will persist till removeRequest
+ lockQueue();
+ LLTextureFetchWorker* worker = getWorkerAfterLock(id);
if (worker)
{
if (worker->mHost != host)
{
LL_WARNS(LOG_TXT) << "LLTextureFetch::createRequest " << id << " called with multiple hosts: "
<< host << " != " << worker->mHost << LL_ENDL;
- removeRequest(worker, true);
+ size_t erased_1 = mRequestMap.erase(worker->mID);
+ llassert_always(erased_1 > 0);
+ unlockQueue();
+ worker->scheduleDelete();
worker = NULL;
return CREATE_REQUEST_ERROR_MHOSTS;
}
}
+ unlockQueue();
S32 desired_size;
std::string exten = gDirUtilp->getExtension(url);
@@ -2717,9 +2725,11 @@ void LLTextureFetch::deleteAllRequests()
}
LLTextureFetchWorker* worker = mRequestMap.begin()->second;
- unlockQueue() ;
+ size_t erased_1 = mRequestMap.erase(worker->mID);
+ llassert_always(erased_1 > 0);
+ unlockQueue();
- removeRequest(worker, true);
+ worker->scheduleDelete();
}
}