Better fix for edge case where abort call to readComplete() can cause a crash.

master
Steve Bennetts 2009-11-12 00:07:07 -08:00
parent 37ac878ec0
commit a7fa9c4936
1 changed files with 10 additions and 9 deletions

View File

@ -1541,23 +1541,24 @@ bool LLTextureCache::readComplete(handle_t handle, bool abort)
{
lockWorkers();
handle_map_t::iterator iter = mReaders.find(handle);
llassert_always(iter != mReaders.end() || abort);
LLTextureCacheWorker* worker = iter->second;
if (!worker)
return false;
bool res = worker->complete();
if (res || abort)
LLTextureCacheWorker* worker = NULL;
bool complete = false;
if (iter != mReaders.end())
{
mReaders.erase(handle);
worker = iter->second;
complete = worker->complete();
}
if (worker && (complete || abort))
{
mReaders.erase(iter);
unlockWorkers();
worker->scheduleDelete();
return true;
}
else
{
unlockWorkers();
return false;
}
return (complete || abort);
}
LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 priority,