summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp13
-rw-r--r--indra/newview/lltexturecache.cpp6
-rw-r--r--indra/newview/lltexturefetch.cpp26
-rw-r--r--indra/newview/lltexturefetch.h2
4 files changed, 42 insertions, 5 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 948d38befb..d7b605fb08 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1515,7 +1515,7 @@ bool LLAppViewer::cleanup()
LLAvatarIconIDCache::getInstance()->save();
llinfos << "Shutting down Threads" << llendflush;
-
+
// Let threads finish
LLTimer idleTimer;
idleTimer.reset();
@@ -1529,19 +1529,26 @@ bool LLAppViewer::cleanup()
pending += LLVFSThread::updateClass(0);
pending += LLLFSThread::updateClass(0);
F64 idle_time = idleTimer.getElapsedTimeF64();
- if (!pending || idle_time >= max_idle_time)
+ if(!pending)
+ {
+ break ; //done
+ }
+ else if(idle_time >= max_idle_time)
{
llwarns << "Quitting with pending background tasks." << llendl;
break;
}
}
-
+
// Delete workers first
// shotdown all worker threads before deleting them in case of co-dependencies
sTextureCache->shutdown();
sTextureFetch->shutdown();
sImageDecodeThread->shutdown();
+ sTextureFetch->shutDownTextureCacheThread() ;
+ sTextureFetch->shutDownImageDecodeThread() ;
+
delete sTextureCache;
sTextureCache = NULL;
delete sTextureFetch;
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 91c303c79e..3116c8feb0 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -750,6 +750,7 @@ LLTextureCache::LLTextureCache(bool threaded)
LLTextureCache::~LLTextureCache()
{
+ clearDeleteList() ;
}
//////////////////////////////////////////////////////////////////////////////
@@ -1574,6 +1575,11 @@ bool LLTextureCache::readComplete(handle_t handle, bool abort)
{
worker = iter->second;
complete = worker->complete();
+
+ if(!complete && abort)
+ {
+ abortRequest(handle, true) ;
+ }
}
if (worker && (complete || abort))
{
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 0053ce8df8..b1b3ae473c 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -431,11 +431,11 @@ LLTextureFetchWorker::~LLTextureFetchWorker()
// << " Desired=" << mDesiredDiscard << llendl;
llassert_always(!haveWork());
lockWorkMutex();
- if (mCacheReadHandle != LLTextureCache::nullHandle())
+ if (mCacheReadHandle != LLTextureCache::nullHandle() && mFetcher->mTextureCache)
{
mFetcher->mTextureCache->readComplete(mCacheReadHandle, true);
}
- if (mCacheWriteHandle != LLTextureCache::nullHandle())
+ if (mCacheWriteHandle != LLTextureCache::nullHandle() && mFetcher->mTextureCache)
{
mFetcher->mTextureCache->writeComplete(mCacheWriteHandle, true);
}
@@ -1429,6 +1429,8 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
LLTextureFetch::~LLTextureFetch()
{
+ clearDeleteList() ;
+
// ~LLQueuedThread() called here
}
@@ -1737,6 +1739,26 @@ S32 LLTextureFetch::update(U32 max_time_ms)
return res;
}
+//called in the MAIN thread after the TextureCacheThread shuts down.
+void LLTextureFetch::shutDownTextureCacheThread()
+{
+ if(mTextureCache)
+ {
+ llassert_always(mTextureCache->isQuitting() || mTextureCache->isStopped()) ;
+ mTextureCache = NULL ;
+ }
+}
+
+//called in the MAIN thread after the ImageDecodeThread shuts down.
+void LLTextureFetch::shutDownImageDecodeThread()
+{
+ if(mImageDecodeThread)
+ {
+ llassert_always(mImageDecodeThread->isQuitting() || mImageDecodeThread->isStopped()) ;
+ mImageDecodeThread = NULL ;
+ }
+}
+
// WORKER THREAD
void LLTextureFetch::startThread()
{
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 5213c4f488..ef2ec520bf 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -58,6 +58,8 @@ public:
~LLTextureFetch();
/*virtual*/ S32 update(U32 max_time_ms);
+ void shutDownTextureCacheThread() ; //called in the main thread after the TextureCacheThread shuts down.
+ void shutDownImageDecodeThread() ; //called in the main thread after the ImageDecodeThread shuts down.
bool createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority,
S32 w, S32 h, S32 c, S32 discard, bool needs_aux);