if (WAIT_HTTP_RESOURCE2 == mState)
- // Don't delete the worker out from under the
- // releaseHttpWaiters() method. Keep the pointers
- // valid, clean up after transition.
+ if (mFetcher->isHttpWaiter(mID))
+ // Don't delete the worker out from under the releaseHttpWaiters()
+ // method. Keep the pointers valid, clean up after that method
+ // has recognized the cancelation and removed the UUID from the
// Allow any pending reads or writes to complete
llassert_always(erased_1 > 0) ;
mNetworkQueueMutex.unlock(); // -Mfnq
+bool LLTextureFetch::isHttpWaiter(const LLUUID & tid)
+ mNetworkQueueMutex.lock(); // +Mfnq
+ wait_http_res_queue_t::iterator iter(mHttpWaitResource.find(tid));
+ const bool ret(mHttpWaitResource.end() != iter);
+ mNetworkQueueMutex.unlock(); // -Mfnq
// Release as many requests as permitted from the WAIT_HTTP_RESOURCE2
// state to the SEND_HTTP_REQ state based on their current priority.
+ // If worker isn't found, this should be due to a request
+ // for deletion. We signal our recognition that this
+ // uuid shouldn't be used for resource waiting anymore by
+ // erasing it from the resource waiter list. That allows
+ // deleteOK to do final deletion on the worker.
+ removeHttpWaiter(* iter);
worker->lockWorkMutex(); // +Mw
if (LLTextureFetchWorker::WAIT_HTTP_RESOURCE2 != worker->mState)
- // Not in expected state, try the next one
+ // Not in expected state, try the next one
worker->unlockWorkMutex(); // -Mw
+ LL_WARNS("Texture") << "Resource-waited texture " << worker->mID
+ << " in unexpected state: " << worker->mState
+ << ". Removing from wait list."