From 609476e607b18d303afa5f5b5eeabeca84f95d16 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 1 Jun 2022 09:25:16 -0500
Subject: [PATCH] SL-17484 More unit test pruning.  Fix for crash when deleting
 textures.

---
 indra/llcommon/llqueuedthread.cpp          | 5 +++++
 indra/llimage/tests/llimageworker_test.cpp | 6 ------
 indra/newview/llviewertexturelist.cpp      | 6 +++++-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 60304fff75c..155e32ebae6 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -75,6 +75,11 @@ void LLQueuedThread::shutdown()
 	unpause(); // MAIN THREAD
 	if (mThreaded)
 	{
+        if (mRequestQueue.size() == 0)
+        {
+            mRequestQueue.close();
+        }
+
 		S32 timeout = 100;
 		for ( ; timeout>0; timeout--)
 		{
diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp
index 57d922b1a1b..d36d35aba4d 100644
--- a/indra/llimage/tests/llimageworker_test.cpp
+++ b/indra/llimage/tests/llimageworker_test.cpp
@@ -199,12 +199,6 @@ namespace tut
 		LLImageDecodeThread::handle_t decodeHandle = mThread->decodeImage(NULL, 0, FALSE, new responder_test(&done));
 		// Verifies we get back a valid handle
 		ensure("LLImageDecodeThread:  threaded decodeImage(), returned handle is null", decodeHandle != 0);
-		// Wait a little so to simulate the main thread doing something on its main loop...
-		ms_sleep(500);		// 500 milliseconds
-		// Verifies that the responder has *not* been called yet in the meantime
-		ensure("LLImageDecodeThread: responder creation failed", done == false);
-		// Ask the thread to update: that means tells the queue to check itself and creates work requests
-		mThread->update(1);
 		// Wait till the thread has time to handle the work order (though it doesn't do much per work order...)
 		const U32 INCREMENT_TIME = 500;				// 500 milliseconds
 		const U32 MAX_TIME = 20 * INCREMENT_TIME;	// Do the loop 20 times max, i.e. wait 10 seconds but no more
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 555355059a7..ac036bce318 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1048,7 +1048,11 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
             {
                 iter = mUUIDMap.begin();
             }
-            entries.push_back(iter->second);
+            
+            if (iter->second->getGLTexture())
+            {
+                entries.push_back(iter->second);
+            }
             ++iter;
         }
     }
-- 
GitLab