From 21b592865228bacf07ec8a526f1756bae69597e0 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Sat, 28 Jan 2023 02:01:49 +0200
Subject: [PATCH] SL-19097 Crash when selecting a model for upload and waiting
 too long

Should be fixed by SL-18996, but just in case user decides to select a model while viewer closes
---
 indra/llprimitive/llmodelloader.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 51716210074..3dd16521547 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -25,6 +25,8 @@
  */
 
 #include "llmodelloader.h"
+
+#include "llapp.h"
 #include "llsdserialize.h"
 #include "lljoint.h"
 #include "llcallbacklist.h"
@@ -363,7 +365,10 @@ bool LLModelLoader::isAlive(LLModelLoader* loader)
 
 void LLModelLoader::loadModelCallback()
 {
-	mLoadCallback(mScene,mModelList,mLod, mOpaqueData);
+    if (!LLApp::isExiting())
+    {
+        mLoadCallback(mScene, mModelList, mLod, mOpaqueData);
+    }
 
 	while (!isStopped())
 	{ //wait until this thread is stopped before deleting self
-- 
GitLab