From edb4373f7d2a32beb93a7f69ddcdf5e1bc0eb6a1 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Thu, 5 Mar 2020 14:13:39 +0200
Subject: SL-9775 FIXED EEP viewer crash when looking at the sun (which is
 playing parcel media)

---
 indra/newview/llface.cpp          | 3 ++-
 indra/newview/llface.h            | 4 ++++
 indra/newview/llviewertexture.cpp | 5 ++++-
 indra/newview/llvosky.cpp         | 4 ++++
 4 files changed, 14 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 174d8e34d1..59269c2115 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -168,7 +168,8 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
 	mImportanceToCamera = 0.f ;
 	mBoundingSphereRadius = 0.0f ;
 
-	mHasMedia = FALSE ;
+	mHasMedia = false ;
+	mIsMediaAllowed = true;
 }
 
 void LLFace::destroy()
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index 0c5af5b579..c74d4e3fa8 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -218,6 +218,9 @@ public:
 	void        setHasMedia(bool has_media)  { mHasMedia = has_media ;}
 	BOOL        hasMedia() const ;
 
+    void        setMediaAllowed(bool is_media_allowed)  { mIsMediaAllowed = is_media_allowed; }
+    BOOL        isMediaAllowed() const { return mIsMediaAllowed; }
+
 	BOOL		switchTexture() ;
 
 	//vertex buffer tracking
@@ -293,6 +296,7 @@ private:
 	F32         mImportanceToCamera ; 
 	F32         mBoundingSphereRadius ;
 	bool        mHasMedia ;
+	bool        mIsMediaAllowed;
 
 	
 protected:
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index f5f9d0d3cc..a2cec9a613 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -3481,7 +3481,10 @@ BOOL LLViewerMediaTexture::findFaces()
 			U32 end = tex->getNumFaces(ch);
 		for(U32 i = 0; i < end; i++)
 		{
-			mMediaFaceList.push_back((*face_list)[i]);
+			if ((*face_list)[i]->isMediaAllowed())
+			{
+				mMediaFaceList.push_back((*face_list)[i]);
+			}
 		}
 	}
 	}
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 943704c8de..2037aca7e9 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -881,6 +881,10 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline)
 	mFace[FACE_MOON]  = mDrawable->addFace(poolp, nullptr);
 	mFace[FACE_BLOOM] = mDrawable->addFace(poolp, nullptr);
 
+	mFace[FACE_SUN]->setMediaAllowed(false);
+	mFace[FACE_MOON]->setMediaAllowed(false);
+	mFace[FACE_BLOOM]->setMediaAllowed(false);
+
 	return mDrawable;
 }
 
-- 
cgit v1.2.3