Commits

Monty Brandenberg committed 301523b

SH-3189 Improve naive data structures
Move releaseHttpWaiters() to commonUpdate from doWork.
More appropriate home for it. Have deleteOK() defer deletion
of anything in WAIT_HTTP_RESOURCE2 state to keep pointers valid
for the releaseHttpWaiters() method. It will then transition
canceled operations to SEND_HTTP_REQ where they can be deleted.

Comments (0)

Files changed (1)

indra/newview/lltexturefetch.cpp

 	static const LLCore::HttpStatus http_service_unavail(HTTP_SERVICE_UNAVAILABLE);		// 503
 	static const LLCore::HttpStatus http_not_sat(HTTP_REQUESTED_RANGE_NOT_SATISFIABLE);	// 416;
 	
-	// Release waiters while we aren't holding the Mw lock.
-	mFetcher->releaseHttpWaiters();
-	
 	LLMutexLock lock(&mWorkMutex);										// +Mw
 
 	if ((mFetcher->isQuitting() || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED)))
 		// and will dereference it to do notification.
 		delete_ok = false;
 	}
+
+	if (WAIT_HTTP_RESOURCE2 == mState)
+	{
+		// Don't delete the worker out from under the
+		// releaseHttpWaiters() method.  Keep the pointers
+		// valid, clean up after transition.
+		delete_ok = false;
+	}
 	
 	// Allow any pending reads or writes to complete
 	if (mCacheReadHandle != LLTextureCache::nullHandle())
 // Threads:  Ttf
 void LLTextureFetch::commonUpdate()
 {
+	// Release waiters
+	releaseHttpWaiters();
+	
 	// Run a cross-thread command, if any.
 	cmdDoWork();