From b06d5aeec8144f18e039758d3c70e9414f83ce21 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Tue, 12 Jul 2016 21:37:45 +0300
Subject: MAINT-6460 Crash calculating mesh complexity

---
 indra/newview/llmeshrepository.cpp | 13 ++++++-------
 indra/newview/llmeshrepository.h   |  4 ++--
 indra/newview/llvovolume.cpp       |  5 +++--
 3 files changed, 11 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 39ebf9f95b..bf7f91d19a 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -3906,8 +3906,8 @@ void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail)
 
 bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id)
 {
-	LLSD mesh = mThread->getMeshHeader(mesh_id);
-	if (mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0))
+	const LLSD* mesh = mThread->getMeshHeader(mesh_id);
+	if (mesh && mesh->has("physics_mesh") && (*mesh)["physics_mesh"].has("size") && ((*mesh)["physics_mesh"]["size"].asInteger() > 0))
 	{
 		return true;
 	}
@@ -3921,27 +3921,26 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id)
 	return false;
 }
 
-LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id)
+const LLSD* LLMeshRepository::getMeshHeader(const LLUUID& mesh_id)
 {
 	LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH);
 
 	return mThread->getMeshHeader(mesh_id);
 }
 
-LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id)
+const LLSD* LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id)
 {
-	static LLSD dummy_ret;
 	if (mesh_id.notNull())
 	{
 		LLMutexLock lock(mHeaderMutex);
 		mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
 		if (iter != mMeshHeader.end())
 		{
-			return iter->second;
+			return &(iter->second);
 		}
 	}
 
-	return dummy_ret;
+	return NULL;
 }
 
 
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index d35c44397b..8a1166522f 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -305,7 +305,7 @@ public:
 	bool skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
 	bool decompositionReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
 	bool physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
-	LLSD& getMeshHeader(const LLUUID& mesh_id);
+	const LLSD* getMeshHeader(const LLUUID& mesh_id);
 
 	void notifyLoadedMeshes();
 	S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
@@ -506,7 +506,7 @@ public:
 	bool meshRezEnabled();
 	
 
-	LLSD& getMeshHeader(const LLUUID& mesh_id);
+	const LLSD* getMeshHeader(const LLUUID& mesh_id);
 
 	void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
 			bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true,
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 8f0b233f01..486f6fae61 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3627,8 +3627,9 @@ F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_v
 	F32 radius = getScale().length()*0.5f;
 
 	if (isMesh())
-	{	
-		LLSD& header = gMeshRepo.getMeshHeader(getVolume()->getParams().getSculptID());
+	{
+		const LLSD* header_ptr = gMeshRepo.getMeshHeader(getVolume()->getParams().getSculptID());
+		LLSD header = header_ptr ? *header_ptr : LLSD();
 
 		return LLMeshRepository::getStreamingCost(header, radius, bytes, visible_bytes, mLOD, unscaled_value);
 	}
-- 
cgit v1.2.3


From d2cf09e7d2fb3eefd4bed4e5341849ee940b9018 Mon Sep 17 00:00:00 2001
From: Ansariel <none@none>
Date: Thu, 14 Jul 2016 10:28:54 +0200
Subject: STORM-2133: VOICE-36 prevents proper shutdown of connector

---
 indra/newview/llvoicevivox.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 07427e0377..189ed54993 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -427,7 +427,7 @@ void LLVivoxVoiceClient::connectorCreate()
 
 void LLVivoxVoiceClient::connectorShutdown()
 {
-	if(!mConnectorEstablished)
+	if(mConnectorEstablished)
 	{
 		std::ostringstream stream;
 		stream
-- 
cgit v1.2.3


From 00a193e740536bc8dbdc7a4c52ae8d75efba0037 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Thu, 14 Jul 2016 15:21:39 +0300
Subject: MAINT-6460 Crash calculating mesh complexity

---
 indra/newview/llmeshrepository.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index bf7f91d19a..a0e57677c3 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -4033,7 +4033,9 @@ void LLMeshRepository::uploadError(LLSD& args)
 //static
 F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)
 {
-	if (header.size() == 0 || header.has("404") || header["version"].asInteger() > MAX_MESH_VERSION)
+	if (header.has("404")
+		|| !header.has("lowest_lod")
+		|| (header.has("version") && header["version"].asInteger() > MAX_MESH_VERSION))
 	{
 		return 0.f;
 	}
-- 
cgit v1.2.3