diff options
author | Steve Bennetts <steve@lindenlab.com> | 2009-11-12 00:07:07 -0800 |
---|---|---|
committer | Steve Bennetts <steve@lindenlab.com> | 2009-11-12 00:07:07 -0800 |
commit | a7fa9c49366dc1d22ee7aeea21c26cd40f2bc7f0 (patch) | |
tree | 5915d7336f51b7b60ed389a6c10046dd0567a61d /indra/newview | |
parent | 37ac878ec06138e35507f0dd007556cc613ee08f (diff) |
Better fix for edge case where abort call to readComplete() can cause a crash.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lltexturecache.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 6a4b967487..9be342c424 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -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, |