diff --git a/.hgtags b/.hgtags
index 973d6a9713b46a556c48fef64fb6d06d7cadf48f..de85203089dac76ddabe601cc1bfc0bd77d79695 100755
--- a/.hgtags
+++ b/.hgtags
@@ -533,3 +533,4 @@ abcab37e1b29414ab8c03af9ca2ab489d809788a 5.0.7-release
 40ca7118765be85a043b31b011e4ee6bd9e33c95 5.0.9-release
 ad0e15543836d64d6399d28b32852510435e344a 5.1.0-release
 26d9e9bb166a9a417f35b1863223a597af8185fd 5.1.1-release
+2eb917875efdfe920680b9049302d0f03721245d 5.1.2-release
diff --git a/autobuild.xml b/autobuild.xml
index 088dd4638ee534414bfb08261338121d81050fb8..9e4d93c5e2b5bac4736d42e0cd35c7a28b63180a 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -3260,9 +3260,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>c4d56d3e942169661a598035a9fbd533</string>
+              <string>f1248b6692dcbb1a42db87ca8d9fed93</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12112/71187/viewer_manager-1.0.511688-darwin64-511688.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/13982/87166/viewer_manager-1.0.512801-darwin64-512801.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -3284,9 +3284,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>61f324d880eaa303669b99e28e6cf64c</string>
+              <string>c174ecc0893f8c193571b1dc80b823ad</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/12113/71193/viewer_manager-1.0.511688-windows-511688.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/13983/87172/viewer_manager-1.0.512801-windows-512801.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
@@ -3297,7 +3297,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
         <key>source_type</key>
         <string>hg</string>
         <key>version</key>
-        <string>1.0.511688</string>
+        <string>1.0.512801</string>
       </map>
       <key>vlc-bin</key>
       <map>
diff --git a/doc/contributions.txt b/doc/contributions.txt
index c98c974e628690245994ebca112e651141a05543..92198918d382063e7fba925ece0ed2009669d532 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -217,6 +217,7 @@ Ansariel Hiller
 	MAINT-6519
 	MAINT-7899
 	STORM-2105
+	STORM-2151
 Aralara Rajal
 Arare Chantilly
 	CHUIBUG-191
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 3a219eb998c66ca938c9a7b4aa33acba2d66961c..be54ed053bee7d6d3d918260251b3ccfaee14810 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -2121,22 +2121,13 @@ std::string zip_llsd(LLSD& data)
 	deflateEnd(&strm);
 	free(output);
 
-#if 0 //verify results work with unzip_llsd
-	std::istringstream test(result);
-	LLSD test_sd;
-	if (!unzip_llsd(test_sd, test, result.size()))
-	{
-		LL_ERRS() << "Invalid compression result!" << LL_ENDL;
-	}
-#endif
-
 	return result;
 }
 
 //decompress a block of LLSD from provided istream
 // not very efficient -- creats a copy of decompressed LLSD block in memory
 // and deserializes from that copy using LLSDSerialize
-bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
+LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size)
 {
 	U8* result = NULL;
 	U32 cur_size = 0;
@@ -2144,7 +2135,11 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
 		
 	const U32 CHUNK = 65536;
 
-	U8 *in = new U8[size];
+	U8 *in = new(std::nothrow) U8[size];
+	if (!in)
+	{
+		return ZR_MEM_ERROR;
+	}
 	is.read((char*) in, size); 
 
 	U8 out[CHUNK];
@@ -2167,7 +2162,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
 			inflateEnd(&strm);
 			free(result);
 			delete [] in;
-			return false;
+			return ZR_DATA_ERROR;
 		}
 		
 		switch (ret)
@@ -2179,7 +2174,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
 			inflateEnd(&strm);
 			free(result);
 			delete [] in;
-			return false;
+			return ZR_MEM_ERROR;
 			break;
 		}
 
@@ -2188,14 +2183,13 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
 		U8* new_result = (U8*)realloc(result, cur_size + have);
 		if (new_result == NULL)
 		{
-			LL_WARNS() << "Failed to unzip LLSD block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL;
 			inflateEnd(&strm);
 			if (result)
 			{
 				free(result);
 			}
 			delete[] in;
-			return false;
+			return ZR_MEM_ERROR;
 		}
 		result = new_result;
 		memcpy(result+cur_size, out, have);
@@ -2209,33 +2203,50 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
 	if (ret != Z_STREAM_END)
 	{
 		free(result);
-		return false;
+		return ZR_DATA_ERROR;
 	}
 
 	//result now points to the decompressed LLSD block
 	{
-		std::string res_str((char*) result, cur_size);
+		std::istringstream istr;
+		// Since we are using this for meshes, data we are dealing with tend to be large.
+		// So string can potentially fail to allocate, make sure this won't cause problems
+		try
+		{
+			std::string res_str((char*)result, cur_size);
 
-		std::string deprecated_header("<? LLSD/Binary ?>");
+			std::string deprecated_header("<? LLSD/Binary ?>");
 
-		if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
+			if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
+			{
+				res_str = res_str.substr(deprecated_header.size() + 1, cur_size);
+			}
+			cur_size = res_str.size();
+
+			istr.str(res_str);
+		}
+#ifdef LL_WINDOWS
+		catch (std::length_error)
+		{
+			free(result);
+			return ZR_SIZE_ERROR;
+		}
+#endif
+		catch (std::bad_alloc)
 		{
-			res_str = res_str.substr(deprecated_header.size()+1, cur_size);
+			free(result);
+			return ZR_MEM_ERROR;
 		}
-		cur_size = res_str.size();
 
-		std::istringstream istr(res_str);
-		
 		if (!LLSDSerialize::fromBinary(data, istr, cur_size))
 		{
-			LL_WARNS() << "Failed to unzip LLSD block" << LL_ENDL;
 			free(result);
-			return false;
-		}		
+			return ZR_PARSE_ERROR;
+		}
 	}
 
 	free(result);
-	return true;
+	return ZR_OK;
 }
 //This unzip function will only work with a gzip header and trailer - while the contents
 //of the actual compressed data is the same for either format (gzip vs zlib ), the headers
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index 23a0c8cfb1e332ea0346517c1cec74d2e33514b9..9f58d44fe7908b0fc70eb5eaba350a160feaea25 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -814,8 +814,24 @@ class LL_COMMON_API LLSDSerialize
 	}
 };
 
+class LL_COMMON_API LLUZipHelper : public LLRefCount
+{
+public:
+    typedef enum e_zip_result
+    {
+        ZR_OK = 0,
+        ZR_MEM_ERROR,
+        ZR_SIZE_ERROR,
+        ZR_DATA_ERROR,
+        ZR_PARSE_ERROR,
+    } EZipRresult;
+    // return OK or reason for failure
+    static EZipRresult unzip_llsd(LLSD& data, std::istream& is, S32 size);
+};
+
 //dirty little zip functions -- yell at davep
 LL_COMMON_API std::string zip_llsd(LLSD& data);
-LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size);
+
+
 LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size);
 #endif // LL_LLSDSERIALIZE_H
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 00acfd1e4c794a19040a729ebf369cbbca036b6c..32e8ea968286423886abc001d9d40f1bfe200042 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -129,50 +129,32 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
 
     sThreadID = threadp->mID;
 
-    try
+    // Run the user supplied function
+    do 
     {
-        // Run the user supplied function
-        do 
+        try
         {
-            try
-            {
-                threadp->run();
-            }
-            catch (const LLContinueError &e)
-            {
-                LL_WARNS("THREAD") << "ContinueException on thread '" << threadp->mName <<
-                    "' reentering run(). Error what is: '" << e.what() << "'" << LL_ENDL;
-                //output possible call stacks to log file.
-                LLError::LLCallStacks::print();
-
-                LOG_UNHANDLED_EXCEPTION("LLThread");
-                continue;
-            }
-            break;
-
-        } while (true);
+            threadp->run();
+        }
+        catch (const LLContinueError &e)
+        {
+            LL_WARNS("THREAD") << "ContinueException on thread '" << threadp->mName <<
+                "' reentering run(). Error what is: '" << e.what() << "'" << LL_ENDL;
+            //output possible call stacks to log file.
+            LLError::LLCallStacks::print();
 
-        //LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL;
+            LOG_UNHANDLED_EXCEPTION("LLThread");
+            continue;
+        }
+        break;
 
-        // We're done with the run function, this thread is done executing now.
-        //NB: we are using this flag to sync across threads...we really need memory barriers here
-        threadp->mStatus = STOPPED;
-    }
-    catch (std::bad_alloc)
-    {
-        threadp->mStatus = CRASHED;
-        LLMemory::logMemoryInfo(TRUE);
+    } while (true);
 
-        //output possible call stacks to log file.
-        LLError::LLCallStacks::print();
+    //LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL;
 
-        LL_ERRS("THREAD") << "Bad memory allocation in LLThread::staticRun() named '" << threadp->mName << "'!" << LL_ENDL;
-    }
-    catch (...)
-    {
-        threadp->mStatus = CRASHED;
-        CRASH_ON_UNHANDLED_EXCEPTION("LLThread");
-    }
+    // We're done with the run function, this thread is done executing now.
+    //NB: we are using this flag to sync across threads...we really need memory barriers here
+    threadp->mStatus = STOPPED;
 
     delete threadp->mRecorder;
     threadp->mRecorder = NULL;
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index cd7125197c9eec853f77f5ce766d562f4cfd05cd..4a76d1509635b24a57975997a11ef803d4911114 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -748,7 +748,11 @@ U8* LLImageBase::allocateData(S32 size)
 	{
 		size = 0;
 		mWidth = mHeight = 0;
-		mData = NULL;
+		if (mData)
+		{
+			deleteData(); // virtual
+			mData = NULL;
+		}
 	}
 	mDataSize = size;
 	claimMem(mDataSize);
@@ -775,6 +779,7 @@ U8* LLImageBase::reallocateData(S32 size)
 	disclaimMem(mDataSize);
 	mDataSize = size;
 	claimMem(mDataSize);
+	mBadBufferAllocation = false;
 	return mData;
 }
 
diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp
index a5e546e97772968009ba981bce6134a9d0c9d497..97b543f3b6fee4fbadcefe3a25edff5c5a944b68 100644
--- a/indra/llimage/llimagedimensionsinfo.cpp
+++ b/indra/llimage/llimagedimensionsinfo.cpp
@@ -163,7 +163,7 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg()
 {
 	sJpegErrorEncountered = false;
 	clean();
-	FILE *fp = fopen (mSrcFilename.c_str(), "rb");
+	FILE *fp = LLFile::fopen(mSrcFilename, "rb");
 	if (fp == NULL) 
 	{
 		setLastError("Unable to open file for reading", mSrcFilename);
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index 68694496bcf502a13989070efc283d36deeca07d..c40df009d8a662304245e5e81fd60dd2b26cc660 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -369,19 +369,28 @@ bool LLImageJ2C::loadAndValidate(const std::string &filename)
 	else
 	{
 		U8 *data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), file_size);
-		apr_size_t bytes_read = file_size;
-		apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read	
-		infile.close() ;
-
-		if (s != APR_SUCCESS || (S32)bytes_read != file_size)
+		if (!data)
 		{
-			FREE_MEM(LLImageBase::getPrivatePool(), data);
-			setLastError("Unable to read entire file");
+			infile.close();
+			setLastError("Out of memory", filename);
 			res = false;
 		}
 		else
 		{
-			res = validate(data, file_size);
+			apr_size_t bytes_read = file_size;
+			apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read	
+			infile.close();
+
+			if (s != APR_SUCCESS || (S32)bytes_read != file_size)
+			{
+				FREE_MEM(LLImageBase::getPrivatePool(), data);
+				setLastError("Unable to read entire file");
+				res = false;
+			}
+			else
+			{
+				res = validate(data, file_size);
+			}
 		}
 	}
 	
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 8b73f0ae8e6ce6510ff1c83492be355795c6470e..24f46d720bb88fba5a3c719e9f5de9812007a977 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2367,9 +2367,10 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
 	//input stream is now pointing at a zlib compressed block of LLSD
 	//decompress block
 	LLSD mdl;
-	if (!unzip_llsd(mdl, is, size))
+	U32 uzip_result = LLUZipHelper::unzip_llsd(mdl, is, size);
+	if (uzip_result != LLUZipHelper::ZR_OK)
 	{
-		LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << LL_ENDL;
+		LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD with code " << uzip_result << " , will probably fetch from sim again." << LL_ENDL;
 		return false;
 	}
 	
@@ -2676,11 +2677,17 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
 			}
 		}
 	}
+
+	if (!cacheOptimize())
+	{
+		// Out of memory?
+		LL_WARNS() << "Failed to optimize!" << LL_ENDL;
+		mVolumeFaces.clear();
+		return false;
+	}
 	
 	mSculptLevel = 0;  // success!
 
-	cacheOptimize();
-
 	return true;
 }
 
@@ -2712,12 +2719,16 @@ void LLVolume::copyVolumeFaces(const LLVolume* volume)
 	mSculptLevel = 0;
 }
 
-void LLVolume::cacheOptimize()
+bool LLVolume::cacheOptimize()
 {
 	for (S32 i = 0; i < mVolumeFaces.size(); ++i)
 	{
-		mVolumeFaces[i].cacheOptimize();
+		if (!mVolumeFaces[i].cacheOptimize())
+		{
+			return false;
+		}
 	}
+	return true;
 }
 
 
@@ -5173,7 +5184,7 @@ class LLVCacheLRU
 };
 
 
-void LLVolumeFace::cacheOptimize()
+bool LLVolumeFace::cacheOptimize()
 { //optimize for vertex cache according to Forsyth method: 
   // http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
 	
@@ -5184,7 +5195,7 @@ void LLVolumeFace::cacheOptimize()
 	
 	if (mNumVertices < 3)
 	{ //nothing to do
-		return;
+		return true;
 	}
 
 	//mapping of vertices to triangles and indices
@@ -5193,8 +5204,16 @@ void LLVolumeFace::cacheOptimize()
 	//mapping of triangles do vertices
 	std::vector<LLVCacheTriangleData> triangle_data;
 
-	triangle_data.resize(mNumIndices/3);
-	vertex_data.resize(mNumVertices);
+	try
+	{
+		triangle_data.resize(mNumIndices / 3);
+		vertex_data.resize(mNumVertices);
+	}
+	catch (std::bad_alloc)
+	{
+		LL_WARNS("LLVOLUME") << "Resize failed" << LL_ENDL;
+		return false;
+	}
 
 	for (U32 i = 0; i < mNumIndices; i++)
 	{ //populate vertex data and triangle data arrays
@@ -5306,7 +5325,8 @@ void LLVolumeFace::cacheOptimize()
 	LLVector4a* pos = (LLVector4a*) ll_aligned_malloc<64>(sizeof(LLVector4a)*2*num_verts+size);
 	if (pos == NULL)
 	{
-		LL_ERRS("LLVOLUME") << "Allocation of positions vector[" << sizeof(LLVector4a) * 2 * num_verts + size  << "] failed. " << LL_ENDL;
+		LL_WARNS("LLVOLUME") << "Allocation of positions vector[" << sizeof(LLVector4a) * 2 * num_verts + size  << "] failed. " << LL_ENDL;
+		return false;
 	}
 	LLVector4a* norm = pos + num_verts;
 	LLVector2* tc = (LLVector2*) (norm + num_verts);
@@ -5317,7 +5337,9 @@ void LLVolumeFace::cacheOptimize()
 		wght = (LLVector4a*)ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 		if (wght == NULL)
 		{
-			LL_ERRS("LLVOLUME") << "Allocation of weights[" << sizeof(LLVector4a) * num_verts << "] failed" << LL_ENDL;
+			ll_aligned_free<64>(pos);
+			LL_WARNS("LLVOLUME") << "Allocation of weights[" << sizeof(LLVector4a) * num_verts << "] failed" << LL_ENDL;
+			return false;
 		}
 	}
 
@@ -5327,13 +5349,28 @@ void LLVolumeFace::cacheOptimize()
 		binorm = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
 		if (binorm == NULL)
 		{
-			LL_ERRS("LLVOLUME") << "Allocation of binormals[" << sizeof(LLVector4a)*num_verts << "] failed" << LL_ENDL;
+			ll_aligned_free<64>(pos);
+			ll_aligned_free_16(wght);
+			LL_WARNS("LLVOLUME") << "Allocation of binormals[" << sizeof(LLVector4a)*num_verts << "] failed" << LL_ENDL;
+			return false;
 		}
 	}
 
 	//allocate mapping of old indices to new indices
 	std::vector<S32> new_idx;
-	new_idx.resize(mNumVertices, -1);
+
+	try
+	{
+		new_idx.resize(mNumVertices, -1);
+	}
+	catch (std::bad_alloc)
+	{
+		ll_aligned_free<64>(pos);
+		ll_aligned_free_16(wght);
+		ll_aligned_free_16(binorm);
+		LL_WARNS("LLVOLUME") << "Resize failed: " << mNumVertices << LL_ENDL;
+		return false;
+	}
 
 	S32 cur_idx = 0;
 	for (U32 i = 0; i < mNumIndices; ++i)
@@ -5379,6 +5416,7 @@ void LLVolumeFace::cacheOptimize()
 	//std::string result = llformat("ACMR pre/post: %.3f/%.3f  --  %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks);
 	//LL_INFOS() << result << LL_ENDL;
 
+	return true;
 }
 
 void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVector4a& size)
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index bba691d2433ef9d417cf322ad06df68331ea87b1..a8089f3709f9cdb1bb4094504dacbbbd5e5b0414 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -903,7 +903,7 @@ class LLVolumeFace
 	};
 
 	void optimize(F32 angle_cutoff = 2.f);
-	void cacheOptimize();
+	bool cacheOptimize();
 
 	void createOctree(F32 scaler = 0.25f, const LLVector4a& center = LLVector4a(0,0,0), const LLVector4a& size = LLVector4a(0.5f,0.5f,0.5f));
 
@@ -1063,7 +1063,7 @@ class LLVolume : public LLRefCount
 	void copyVolumeFaces(const LLVolume* volume);
 	void copyFacesTo(std::vector<LLVolumeFace> &faces) const;
 	void copyFacesFrom(const std::vector<LLVolumeFace> &faces);
-	void cacheOptimize();
+	bool cacheOptimize();
 
 private:
 	void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type);
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 5a112b543297fb8c0a26d5439af5f5d845db494c..abe0e46e5d865a80292ecd4f50a87928749fedc6 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -769,7 +769,7 @@ LLUUID LLAvatarNameCache::findIdByName(const std::string& name)
 
     // Legacy method
     LLUUID id;
-    if (gCacheName->getUUID(name, id))
+    if (gCacheName && gCacheName->getUUID(name, id))
     {
         return id;
     }
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index db6d00bc2cfc9b749e0ca7617ac6fdea0d166322..8fbb4f6b96a60ffe5832876d3a191b5a93816ae6 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1034,8 +1034,11 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
 	{  //no exact match found, get closest point
 		const F32 epsilon = 1e-5f;
 		weight_map::iterator iter_up = mSkinWeights.lower_bound(pos);
-		weight_map::iterator iter_down = ++iter_up;
-
+		weight_map::iterator iter_down = iter_up;
+		if (iter_up != mSkinWeights.end())
+		{
+			iter_down = ++iter_up;
+		}
 		weight_map::iterator best = iter_up;
 
 		F32 min_dist = (iter->first - pos).magVec();
@@ -1354,7 +1357,7 @@ bool LLModel::loadSkinInfo(LLSD& header, std::istream &is)
 
 		LLSD skin_data;
 
-		if (unzip_llsd(skin_data, is, size))
+		if (LLUZipHelper::unzip_llsd(skin_data, is, size) == LLUZipHelper::ZR_OK)
 		{
 			mSkinInfo.fromLLSD(skin_data);
 			return true;
@@ -1375,7 +1378,7 @@ bool LLModel::loadDecomposition(LLSD& header, std::istream& is)
 
 		LLSD data;
 
-		if (unzip_llsd(data, is, size))
+		if (LLUZipHelper::unzip_llsd(data, is, size) == LLUZipHelper::ZR_OK)
 		{
 			mPhysics.fromLLSD(data);
 			updateHullCenters();
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 20cba68f84779cbdbad1bc77560aa044f07662e6..89500dcc040939f052afba9bc447ca8353e268ed 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -622,7 +622,7 @@ void LLImageGL::setImage(const LLImageRaw* imageraw)
 }
 
 static LLTrace::BlockTimerStatHandle FTM_SET_IMAGE("setImage");
-void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
+BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 {
 	LL_RECORD_BLOCK_TIME(FTM_SET_IMAGE);
 	bool is_compressed = false;
@@ -787,19 +787,33 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 						llassert(prev_mip_data);
 						llassert(cur_mip_size == bytes*4);
 #endif
-						U8* new_data = new U8[bytes];
+						U8* new_data = new(std::nothrow) U8[bytes];
+						if (!new_data)
+						{
+							stop_glerror();
+
+							if (prev_mip_data)
+								delete[] prev_mip_data;
+							if (cur_mip_data)
+								delete[] cur_mip_data;
+							
+							mGLTextureCreated = false;
+							return FALSE;
+						}
+						else
+						{
 
 #ifdef SHOW_ASSERT
-						llassert(prev_mip_data);
-						llassert(cur_mip_size == bytes*4);
-						llassert_always(new_data);
+							llassert(prev_mip_data);
+							llassert(cur_mip_size == bytes * 4);
 #endif
 
-						LLImageBase::generateMip(prev_mip_data, new_data, w, h, mComponents);
-						cur_mip_data = new_data;
+							LLImageBase::generateMip(prev_mip_data, new_data, w, h, mComponents);
+							cur_mip_data = new_data;
 #ifdef SHOW_ASSERT
-						cur_mip_size = bytes; 
+							cur_mip_size = bytes;
 #endif
+						}
 
 					}
 					llassert(w > 0 && h > 0 && cur_mip_data);
@@ -886,6 +900,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
 	}
 	stop_glerror();
 	mGLTextureCreated = true;
+	return TRUE;
 }
 
 BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
@@ -1355,8 +1370,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
 	if (mTexName != 0 && discard_level == mCurrentDiscardLevel)
 	{
 		// This will only be true if the size has not changed
-		setImage(data_in, data_hasmips);
-		return TRUE;
+		return setImage(data_in, data_hasmips);
 	}
 	
 	U32 old_name = mTexName;
@@ -1398,7 +1412,11 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
 
 	mCurrentDiscardLevel = discard_level;	
 
-	setImage(data_in, data_hasmips);
+	if (!setImage(data_in, data_hasmips))
+	{
+		stop_glerror();
+		return FALSE;
+	}
 
 	// Set texture options to our defaults.
 	gGL.getTexUnit(0)->setHasMipMaps(mHasMipMaps);
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index ad2aea90675e9b63d5f1bb6229e562fc44b1be68..2be54be062a9ef0f892b734b239b0238683ed44e 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -105,7 +105,7 @@ class LLImageGL : public LLRefCount, public LLTrace::MemTrackable<LLImageGL>
 		S32 category = sMaxCategories-1);
 	BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0);
 	void setImage(const LLImageRaw* imageraw);
-	void setImage(const U8* data_in, BOOL data_hasmips = FALSE);
+	BOOL setImage(const U8* data_in, BOOL data_hasmips = FALSE);
 	BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update = FALSE);
 	BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update = FALSE);
 	BOOL setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height);
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 50487998546a472571e317444c4ba390ab348514..f10301b42d0864a9ca44c9be535ffeabfcb8e24a 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1057,10 +1057,12 @@ LLVertexBuffer::~LLVertexBuffer()
 
 	if (mFence)
 	{
+		// Sanity check. We have weird crashes in this destructor (on delete). Yet mFence is disabled.
+		// TODO: mFence was added in scope of SH-2038, but was never enabled, consider removing mFence.
+		LL_ERRS() << "LLVertexBuffer destruction failed" << LL_ENDL;
 		delete mFence;
+		mFence = NULL;
 	}
-	
-	mFence = NULL;
 
 	sVertexCount -= mNumVerts;
 	sIndexCount -= mNumIndices;
@@ -1930,7 +1932,21 @@ void LLVertexBuffer::unmapBuffer()
 					const MappedRegion& region = mMappedVertexRegions[i];
 					S32 offset = region.mIndex >= 0 ? mOffsets[region.mType]+sTypeSize[region.mType]*region.mIndex : 0;
 					S32 length = sTypeSize[region.mType]*region.mCount;
-					glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedData+offset);
+					if (mSize >= length + offset)
+					{
+						glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*)mMappedData + offset);
+					}
+					else
+					{
+						GLint size = 0;
+						glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
+						LL_WARNS() << "Attempted to map regions to a buffer that is too small, " 
+							<< "mapped size: " << mSize
+							<< ", gl buffer size: " << size
+							<< ", length: " << length
+							<< ", offset: " << offset
+							<< LL_ENDL;
+					}
 					stop_glerror();
 				}
 
@@ -1998,7 +2014,21 @@ void LLVertexBuffer::unmapBuffer()
 					const MappedRegion& region = mMappedIndexRegions[i];
 					S32 offset = region.mIndex >= 0 ? sizeof(U16)*region.mIndex : 0;
 					S32 length = sizeof(U16)*region.mCount;
-					glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset);
+					if (mIndicesSize >= length + offset)
+					{
+						glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset);
+					}
+					else
+					{
+						GLint size = 0;
+						glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
+						LL_WARNS() << "Attempted to map regions to a buffer that is too small, " 
+							<< "mapped size: " << mIndicesSize
+							<< ", gl buffer size: " << size
+							<< ", length: " << length
+							<< ", offset: " << offset
+							<< LL_ENDL;
+					}
 					stop_glerror();
 				}
 
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index 42726de0ad3d1b95d44a9025f8e9deba03bee90b..15b6899d74660cc49d7605008dd9ab120a2f605c 100644
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -224,7 +224,7 @@ void LLBadge::draw()
 	{
 		LLView* owner_view = mOwner.get();
 
-		if (owner_view)
+		if (owner_view && owner_view->isInVisibleChain())
 		{
 			//
 			// Calculate badge size based on label text
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index a4243ebfa18fc456a9a8ebcd9adf196182e028e8..a4dc5bcde1694d2c2f17e4a254e0957828516ff3 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -190,31 +190,32 @@ bool LLUrlEntryBase::isWikiLinkCorrect(std::string url)
 
 std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const
 {
-	LLUriParser up(unescapeUrl(url));
+	LLUriParser up(escapeUrl(url));
 	up.normalize();
 
 	std::string label;
 	up.extractParts();
 	up.glueFirst(label);
 
-	return label;
+	return unescapeUrl(label);
 }
 
 std::string LLUrlEntryBase::urlToGreyQuery(const std::string &url) const
 {
-	LLUriParser up(unescapeUrl(url));
+	std::string escaped_url = escapeUrl(url);
+	LLUriParser up(escaped_url);
 
 	std::string label;
 	up.extractParts();
 	up.glueFirst(label, false);
 
-	size_t pos = url.find(label);
+	size_t pos = escaped_url.find(label);
 	if (pos == std::string::npos)
 	{
 		return "";
 	}
 	pos += label.size();
-	return url.substr(pos);
+	return unescapeUrl(escaped_url.substr(pos));
 }
 
 
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index fa6593267a693497afb2d4513de7bfa115d1a831..ba6fa1e2e9586d596a21fae09b4664683fdf72e2 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -212,7 +212,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
 			}
 		}
 	}
-	
+
 	// did we find a match? if so, return its details in the match object
 	if (match_entry)
 	{
@@ -223,33 +223,6 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
 		// fill in the LLUrlMatch object and return it
 		std::string url = text.substr(match_start, match_end - match_start + 1);
 
-		LLUrlEntryBase *stripped_entry = NULL;
-		if((match_entry != mUrlEntryNoLink) && (match_entry != mUrlEntryHTTPLabel) && (match_entry !=mUrlEntrySLLabel)
-		        && LLStringUtil::containsNonprintable(url))
-		{
-			LLStringUtil::stripNonprintable(url);
-
-			std::vector<LLUrlEntryBase *>::iterator iter;
-			for (iter = mUrlEntry.begin(); iter != mUrlEntry.end(); ++iter)
-			{
-				LLUrlEntryBase *url_entry = *iter;
-				U32 start = 0, end = 0;
-				if (matchRegex(url.c_str(), url_entry->getPattern(), start, end))
-				{
-					if (mLLUrlEntryInvalidSLURL == *iter)
-					{
-						if(url_entry && url_entry->isSLURLvalid(url))
-						{
-							continue;
-						}
-					}
-					stripped_entry = url_entry;
-					break;
-				}
-			}
-		}
-
-
 		if (match_entry == mUrlEntryTrusted)
 		{
 			LLUriParser up(url);
@@ -257,12 +230,10 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
 			url = up.normalizedUri();
 		}
 
-		std::string url_label = stripped_entry? stripped_entry->getLabel(url, cb) : match_entry->getLabel(url, cb);
-		std::string url_query = stripped_entry? stripped_entry->getQuery(url) : match_entry->getQuery(url);
 		match.setValues(match_start, match_end,
 						match_entry->getUrl(url),
-						url_label,
-						url_query,
+						match_entry->getLabel(url, cb),
+						match_entry->getQuery(url),
 						match_entry->getTooltip(url),
 						match_entry->getIcon(url),
 						match_entry->getStyle(),
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 1a280661b92e2f38a91c3fbba6d90322e157049a..9fa07d1d341e3bf3fc747b3c8d606d94f21bf461 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -421,6 +421,11 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
 	mKeyVirtualKey = 0;
 	mhDC = NULL;
 	mhRC = NULL;
+	
+	if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0))
+	{
+		mMouseVanish = TRUE;
+	}
 
 	// Initialize the keyboard
 	gKeyboard = new LLKeyboardWin32();
@@ -1096,7 +1101,14 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		mhInstance,
 		NULL);
 
-	LL_INFOS("Window") << "window is created." << LL_ENDL ;
+	if (mWindowHandle)
+	{
+		LL_INFOS("Window") << "window is created." << LL_ENDL ;
+	}
+	else
+	{
+		LL_WARNS("Window") << "Window creation failed, code: " << GetLastError() << LL_ENDL;
+	}
 
 	//-----------------------------------------------------------------------
 	// Create GL drawing context
@@ -1411,7 +1423,16 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 			mhInstance,
 			NULL);
 
-		LL_INFOS("Window") << "recreate window done." << LL_ENDL ;
+
+		if (mWindowHandle)
+		{
+			LL_INFOS("Window") << "recreate window done." << LL_ENDL ;
+		}
+		else
+		{
+			// Note: if value is NULL GetDC retrieves the DC for the entire screen.
+			LL_WARNS("Window") << "Window recreation failed, code: " << GetLastError() << LL_ENDL;
+		}
 
 		if (!(mhDC = GetDC(mWindowHandle)))
 		{
@@ -1680,7 +1701,7 @@ void LLWindowWin32::showCursorFromMouseMove()
 
 void LLWindowWin32::hideCursorUntilMouseMove()
 {
-	if (!mHideCursorPermanent)
+	if (!mHideCursorPermanent && mMouseVanish)
 	{
 		hideCursor();
 		mHideCursorPermanent = FALSE;
@@ -2641,20 +2662,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			}
 
 		case WM_SETFOCUS:
-			window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETFOCUS");
 			if (gDebugWindowProc)
 			{
 				LL_INFOS("Window") << "WINDOWPROC SetFocus" << LL_ENDL;
 			}
+			window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETFOCUS");
 			window_imp->mCallbacks->handleFocus(window_imp);
 			return 0;
 
 		case WM_KILLFOCUS:
-			window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KILLFOCUS");
 			if (gDebugWindowProc)
 			{
 				LL_INFOS("Window") << "WINDOWPROC KillFocus" << LL_ENDL;
 			}
+			window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KILLFOCUS");
 			window_imp->mCallbacks->handleFocusLost(window_imp);
 			return 0;
 
@@ -2668,6 +2689,18 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			return 0;			
 
 			break;
+
+		case WM_SETTINGCHANGE:
+			{
+				if (w_param == SPI_SETMOUSEVANISH)
+				{
+					if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &window_imp->mMouseVanish, 0))
+					{
+						window_imp->mMouseVanish = TRUE;
+					}
+				}
+			}
+			break;
 		}
 
 	window_imp->mCallbacks->handlePauseWatchdog(window_imp);	
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 059a008c45023f17df218405906d29f11104d85d..d72623a6f40602bcb466ed87a9bcc196d0a2240e 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -214,6 +214,8 @@ class LLWindowWin32 : public LLWindow
 	U32				mRawWParam;
 	U32				mRawLParam;
 
+	BOOL			mMouseVanish;
+
 	friend class LLWindowManager;
 };
 
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index 61fcc87350341bc51d640aa9161073ce615703ce..cdb98d26e4e806a8c7728f8e1c758f97d4047017 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-5.1.2
+5.1.3
diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml
index 90f06746c9fd733a6bd369c08a922409852b804d..df30f46002d072811a8b3e8c46e90df9ed1789d2 100644
--- a/indra/newview/character/avatar_lad.xml
+++ b/indra/newview/character/avatar_lad.xml
@@ -530,7 +530,7 @@
      location="ATTACH_FACE_JAW"
      position="0.000 0.000 0.000"
      rotation="0 0 0"
-     visible_in_first_person="true"/>
+     visible_in_first_person="false"/>
 
     <attachment_point
      id="48"
@@ -541,7 +541,7 @@
      location="ATTACH_FACE_LEAR"
      position="0.000 0.000 0.000"
      rotation="0 0 0"
-     visible_in_first_person="true"/>
+     visible_in_first_person="false"/>
 
     <attachment_point
      id="49"
@@ -552,7 +552,7 @@
      location="ATTACH_FACE_REAR"
      position="0.000 0.000 0.000"
      rotation="0 0 0"
-     visible_in_first_person="true"/>
+     visible_in_first_person="false"/>
 
     <attachment_point
      id="50"
@@ -563,7 +563,7 @@
      location="ATTACH_FACE_LEYE"
      position="0.000 0.000 0.000"
      rotation="0 0 0"
-     visible_in_first_person="true"/>
+     visible_in_first_person="false"/>
 
     <attachment_point
      id="51"
@@ -574,7 +574,7 @@
      location="ATTACH_FACE_REYE"
      position="0.000 0.000 0.000"
      rotation="0 0 0"
-     visible_in_first_person="true"/>
+     visible_in_first_person="false"/>
 
     <attachment_point
      id="52"
@@ -585,7 +585,7 @@
      location="ATTACH_FACE_TONGUE"
      position="0.000 0.000 0.000"
      rotation="0 0 0"
-     visible_in_first_person="true"/>
+     visible_in_first_person="false"/>
 
     <attachment_point
      id="53"
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 8fe684ad7974db0d3ed65bb343e9cd6424a75e1b..f0b74e743957c012d71bde75dcf5a81199b8ee93 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -1011,7 +1011,7 @@ void LLAvatarActions::toggleMute(const LLUUID& id, U32 flags)
 	LLAvatarNameCache::get(id, &av_name);
 
 	LLMuteList* mute_list = LLMuteList::getInstance();
-	bool is_muted = mute_list->isMuted(id, LLMute::flagVoiceChat);
+	bool is_muted = mute_list->isMuted(id, flags);
 
 	LLMute mute(id, av_name.getUserName(), LLMute::AGENT);
 	if (!is_muted)
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index f5721fb34842729f648a3f3f93b1e49a95fd551f..eddc87efcd503199e8ed167841bc5898112aec7f 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -242,27 +242,28 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification)
 
 	S32 chars_in_line = mMsgText->getRect().getWidth() / messageFont->getWidth("c");
 	S32 max_lines = notification["available_height"].asInteger() / (mMsgText->getTextPixelHeight() + 4);
-	S32 new_line_chars = std::count(messageText.begin(), messageText.end(), '\n');
-	S32 lines_count = (messageText.size() - new_line_chars) / chars_in_line + new_line_chars + 1;
+	int lines = 0;
+	int chars = 0;
 
-	//Remove excessive chars if message is not fit in available height. MAINT-6891
-	if(lines_count > max_lines)
+	//Remove excessive chars if message does not fit in available height. MAINT-6891
+	std::string::iterator it;
+	for (it = messageText.begin(); it < messageText.end() && lines < max_lines; it++)
 	{
-		while(lines_count > max_lines)
+		if (*it == '\n')
+			++lines;
+		else
+			++chars;
+
+		if (chars >= chars_in_line)
 		{
-			std::size_t nl_pos = messageText.rfind('\n');
-			if (nl_pos != std::string::npos)
-			{
-				nl_pos = nl_pos > messageText.length() - chars_in_line? nl_pos : messageText.length() - chars_in_line;
-				messageText.erase(messageText.begin() + nl_pos, messageText.end());
-			}
-			else
-			{
-				messageText.erase(messageText.end() - chars_in_line, messageText.end());
-			}
-			new_line_chars = std::count(messageText.begin(), messageText.end(), '\n');
-			lines_count = (messageText.size() - new_line_chars) / chars_in_line + new_line_chars;
+			chars = 0;
+			++lines;
 		}
+	}
+
+	if (it < messageText.end())
+	{
+		messageText.erase(it, messageText.end());
 		messageText += " ...";
 	}
 
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index d614d612ff5408ceec939a1c18b509b989a089b3..5b4b7789b482f4c803266917d053e27bdc4b2ef1 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -750,7 +750,7 @@ void LLFavoritesBarCtrl::updateButtons()
 		return;
 	}
 
-	if(mGetPrevItems)
+	if(mGetPrevItems && gInventory.isCategoryComplete(mFavoriteFolderId))
 	{
 	    for (LLInventoryModel::item_array_t::iterator it = mItems.begin(); it != mItems.end(); it++)
 	    {
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 7e92643b933c5c630e650605b28c0cc20ce107bd..125a823e582e4c250c017f30dddbe42b3d5e5f8d 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -341,7 +341,7 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter)
 					dirname = filename + "\\";
 				else
 					mFiles.push_back(dirname + filename);
-				tptrw += filename.size();
+				tptrw += wcslen(tptrw);
 			}
 		}
 	}
diff --git a/indra/newview/llfloateravatarrendersettings.cpp b/indra/newview/llfloateravatarrendersettings.cpp
index 8bdb70a20d2b23b73fb2d3a91a780f835b78040a..b8f854feb327cb1e6dd569256c0969e074934c0d 100644
--- a/indra/newview/llfloateravatarrendersettings.cpp
+++ b/indra/newview/llfloateravatarrendersettings.cpp
@@ -89,20 +89,11 @@ BOOL LLFloaterAvatarRenderSettings::postBuild()
     LLFloater::postBuild();
     mAvatarSettingsList = getChild<LLNameListCtrl>("render_settings_list");
     mAvatarSettingsList->setRightMouseDownCallback(boost::bind(&LLFloaterAvatarRenderSettings::onAvatarListRightClick, this, _1, _2, _3));
-    this->setVisibleCallback(boost::bind(&LLFloaterAvatarRenderSettings::removePicker, this));
     getChild<LLFilterEditor>("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterAvatarRenderSettings::onFilterEdit, this, _2));
 
 	return TRUE;
 }
 
-void LLFloaterAvatarRenderSettings::removePicker()
-{
-    if(mPicker.get())
-    {
-        mPicker.get()->closeFloater();
-    }
-}
-
 void LLFloaterAvatarRenderSettings::draw()
 {
     if(mNeedsUpdate)
@@ -263,8 +254,6 @@ void LLFloaterAvatarRenderSettings::onClickAdd(const LLSD& userdata)
     {
         root_floater->addDependentFloater(picker);
     }
-
-    mPicker = picker->getHandle();
 }
 
 void LLFloaterAvatarRenderSettings::callbackAvatarPicked(const uuid_vec_t& ids, S32 visual_setting)
diff --git a/indra/newview/llfloateravatarrendersettings.h b/indra/newview/llfloateravatarrendersettings.h
index 6790b24b90bc30c4409125c29a8eaa73c9da323c..00ee074f17510690e6924eac0a4021ce1b854a23 100644
--- a/indra/newview/llfloateravatarrendersettings.h
+++ b/indra/newview/llfloateravatarrendersettings.h
@@ -66,7 +66,6 @@ class LLFloaterAvatarRenderSettings : public LLFloater
     bool mNeedsUpdate;
     LLListContextMenu* mContextMenu;
     LLNameListCtrl* mAvatarSettingsList;
-    LLHandle<LLFloater> mPicker;
 
     std::string mNameFilter;
 };
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index 4fd5c0587afd6f8f70ddaa7af1c2f9756e03a795..2afd889609ff1a56a0541b1c0156efcc4d8058d4 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -171,8 +171,12 @@ void LLFloaterMediaSettings::onClose(bool app_quitting)
 void LLFloaterMediaSettings::initValues( const LLSD& media_settings, bool editable )
 {
 	if (sInstance->hasFocus()) return;
-	
-	sInstance->clearValues(editable);
+
+	// Clear values
+	sInstance->mPanelMediaSettingsGeneral->clearValues(sInstance->mPanelMediaSettingsGeneral, editable, false /*don't update preview*/);
+	sInstance->mPanelMediaSettingsSecurity->clearValues(sInstance->mPanelMediaSettingsSecurity,	editable);
+	sInstance->mPanelMediaSettingsPermissions->clearValues(sInstance->mPanelMediaSettingsPermissions,  editable);
+
 	// update all panels with values from simulator
 	sInstance->mPanelMediaSettingsGeneral->
 		initValues( sInstance->mPanelMediaSettingsGeneral, media_settings, editable );
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 522263703962eac334edd6d23eba88badd7f0d15..5de7ca5289f27c498f18100f6dd530e364bae681 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1304,7 +1304,6 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
 	BOOL shaders = ctrl_shader_enable->get();
 	if (shaders)
 	{
-		terrain_detail->setValue(1);
 		terrain_detail->setEnabled(FALSE);
 		terrain_text->setEnabled(FALSE);
 	}
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index a446b767acb0bef9daba63dd35e50f0004f41f7a..66e832111b6132195beb281cbfbc449a5c77e4b7 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -100,6 +100,7 @@ LLFloaterSearch::LLFloaterSearch(const Params& key) :
 	mCategoryPaths["events"]       = "search/events";
 	mCategoryPaths["groups"]       = "search/groups";
 	mCategoryPaths["wiki"]         = "search/wiki";
+	mCategoryPaths["land"]         = "land";
 	mCategoryPaths["destinations"] = "destinations";
 	mCategoryPaths["classifieds"]  = "classifieds";
 }
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 2869256d093d129b99dd0ee868c199af590d9e39..c9d664c7c40eea222dd77b05abe8556ae8060243 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -1317,7 +1317,6 @@ void LLFloaterTools::getMediaState()
 	
 	std::string multi_media_info_str = LLTrans::getString("Multiple Media");
 	std::string media_title = "";
-	mNeedMediaTitle = false;
 	// update UI depending on whether "object" (prim or face) has media
 	// and whether or not you are allowed to edit it.
 	
@@ -1335,17 +1334,12 @@ void LLFloaterTools::getMediaState()
 			{
 				// initial media title is the media URL (until we get the name)
 				media_title = media_data_get.getHomeURL();
-
-				// kick off a navigate and flag that we need to update the title
-				navigateToTitleMedia( media_data_get.getHomeURL() );
-				mNeedMediaTitle = true;
 			}
 			// else all faces might be empty. 
 		}
 		else // there' re Different Medias' been set on on the faces.
 		{
 			media_title = multi_media_info_str;
-			mNeedMediaTitle = false;
 		}
 		
 		getChildView("media_tex")->setEnabled(bool_has_media && editable);
@@ -1362,7 +1356,6 @@ void LLFloaterTools::getMediaState()
 		if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)
 		{
 			media_title = multi_media_info_str;
-			mNeedMediaTitle = false;
 		}
 		else
 		{
@@ -1371,10 +1364,6 @@ void LLFloaterTools::getMediaState()
 			{
 				// initial media title is the media URL (until we get the name)
 				media_title = media_data_get.getHomeURL();
-
-				// kick off a navigate and flag that we need to update the title
-				navigateToTitleMedia( media_data_get.getHomeURL() );
-				mNeedMediaTitle = true;
 			}
 		}
 		
@@ -1383,6 +1372,8 @@ void LLFloaterTools::getMediaState()
 		getChildView("delete_media")->setEnabled(TRUE);
 		getChildView("add_media")->setEnabled(editable);
 	}
+
+	navigateToTitleMedia(media_title);
 	media_info->setText(media_title);
 	
 	// load values for media settings
@@ -1472,16 +1463,31 @@ void LLFloaterTools::clearMediaSettings()
 //
 void LLFloaterTools::navigateToTitleMedia( const std::string url )
 {
-	if ( mTitleMedia )
+	std::string multi_media_info_str = LLTrans::getString("Multiple Media");
+	if (url.empty() || multi_media_info_str == url)
+	{
+		// nothing to show
+		mNeedMediaTitle = false;
+	}
+	else if (mTitleMedia)
 	{
 		LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin();
-		if ( media_plugin )
+
+		if ( media_plugin ) // Shouldn't this be after navigateTo creates plugin?
 		{
 			// if it's a movie, we don't want to hear it
 			media_plugin->setVolume( 0 );
 		};
-		mTitleMedia->navigateTo( url );
-	};
+
+		// check if url changed or if we need a new media source
+		if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == NULL)
+		{
+			mTitleMedia->navigateTo( url );
+		}
+
+		// flag that we need to update the title (even if no request were made)
+		mNeedMediaTitle = true;
+	}
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index 8f586f7da6d7a8136d7a70447a9f0e9f8564de9a..ffff564ad41b03fd5d5cc2101c6402edbc6be17b 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -102,8 +102,6 @@ class LLFloaterTools
 	void onClickBtnAddMedia();
 	void onClickBtnEditMedia();
 	void clearMediaSettings();
-	void updateMediaTitle();
-	void navigateToTitleMedia( const std::string url );
 	bool selectedMediaEditable();
 	void updateLandImpacts();
 
@@ -116,6 +114,8 @@ class LLFloaterTools
 	void refreshMedia();
 	void getMediaState();
 	void updateMediaSettings();
+	void navigateToTitleMedia( const std::string url ); // navigate if changed
+	void updateMediaTitle();
 	static bool deleteMediaConfirm(const LLSD& notification, const LLSD& response);
 	static bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response);
 	static void setObjectType( LLPCode pcode );
diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp
index a351921d8d242fe14fcff947cdd9a901ab1eb673..2b33bc69356d7b565c65d1653938883236799d0f 100644
--- a/indra/newview/llfloatertwitter.cpp
+++ b/indra/newview/llfloatertwitter.cpp
@@ -403,13 +403,12 @@ void LLTwitterPhotoPanel::clearAndClose()
 void LLTwitterPhotoPanel::updateStatusTextLength(BOOL restore_old_status_text)
 {
 	bool add_location = mLocationCheckbox->getValue().asBoolean();
-	bool add_photo = mPhotoCheckbox->getValue().asBoolean();
 
 	// Restrict the status text length to Twitter's character limit
 	LLTextEditor* status_text_box = dynamic_cast<LLTextEditor*>(mStatusTextBox);
 	if (status_text_box)
 	{
-		int max_status_length = 140 - (add_location ? 40 : 0) - (add_photo ? 40 : 0);
+		int max_status_length = 280 - (add_location ? 40 : 0);
 		status_text_box->setMaxTextLength(max_status_length);
 		if (restore_old_status_text)
 		{
diff --git a/indra/newview/llinspectgroup.cpp b/indra/newview/llinspectgroup.cpp
index a4fce36783f4d6202fea59e52791c994f0c3362a..8332443162add399e0c24916f6cc70618a662e8d 100644
--- a/indra/newview/llinspectgroup.cpp
+++ b/indra/newview/llinspectgroup.cpp
@@ -205,7 +205,7 @@ void LLInspectGroup::nameUpdatedCallback(
 {
 	if (id == mGroupID)
 	{
-		getChild<LLUICtrl>("group_name")->setValue( LLSD(name) );
+		getChild<LLUICtrl>("group_name")->setValue(LLSD("<nolink>" + name + "</nolink>"));
 	}
 	
 	// Otherwise possibly a request for an older inspector, ignore it
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 904bc29929cf90c61701a39207f57305048adc4b..3acfaeb04973d8042a0bc6944a02c267871ec3c8 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -43,6 +43,7 @@
 #include "llfloatermarketplacelistings.h"
 #include "llfloateroutfitphotopreview.h"
 #include "llfloatersidepanelcontainer.h"
+#include "llsidepanelinventory.h"
 #include "llfloaterworldmap.h"
 #include "llfolderview.h"
 #include "llfriendcard.h"
@@ -1828,11 +1829,24 @@ void LLItemBridge::gotoItem()
 	LLInventoryObject *obj = getInventoryObject();
 	if (obj && obj->getIsLinkType())
 	{
-		LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
-		if (active_panel)
+		const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX);
+		if (gInventory.isObjectDescendentOf(obj->getLinkedUUID(), inbox_id))
 		{
-			active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO);
+			LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+			if (sidepanel_inventory && sidepanel_inventory->getInboxPanel())
+			{
+				sidepanel_inventory->getInboxPanel()->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO);
+			}
+		}
+		else
+		{
+			LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+			if (active_panel)
+			{
+				active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO);
+			}
 		}
+
 	}
 }
 
@@ -2199,8 +2213,24 @@ std::string LLFolderBridge::getLabelSuffix() const
     {
         return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str());
     }
-    
-    return LLInvFVBridge::getLabelSuffix();
+    std::string suffix = "";
+    if(mShowDescendantsCount)
+    {
+        LLInventoryModel::cat_array_t cat_array;
+        LLInventoryModel::item_array_t item_array;
+        gInventory.collectDescendents(getUUID(), cat_array, item_array, TRUE);
+        S32 count = item_array.size();
+        if(count > 0)
+        {
+            std::ostringstream oss;
+            oss << count;
+            LLStringUtil::format_map_t args;
+            args["[ITEMS_COUNT]"] = oss.str();
+            suffix = " " + LLTrans::getString("InventoryItemsCount", args);
+        }
+    }
+
+    return LLInvFVBridge::getLabelSuffix() + suffix;
 }
 
 LLFontGL::StyleFlags LLFolderBridge::getLabelStyle() const
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index fd532c609c6f55a21eacf2498352450accc513f3..fd5c0433b1d3682d2d64abc92122fbeb10a76bcb 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -268,7 +268,8 @@ class LLFolderBridge : public LLInvFVBridge
 	:	LLInvFVBridge(inventory, root, uuid),
 		mCallingCards(FALSE),
 		mWearables(FALSE),
-		mIsLoading(false)
+		mIsLoading(false),
+		mShowDescendantsCount(false)
 	{}
 		
 	BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm = TRUE);
@@ -293,6 +294,8 @@ class LLFolderBridge : public LLInvFVBridge
 	virtual std::string getLabelSuffix() const;
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
 
+	void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;}
+
 	virtual BOOL renameItem(const std::string& new_name);
 
 	virtual BOOL removeItem();
@@ -373,6 +376,7 @@ class LLFolderBridge : public LLInvFVBridge
 	bool							mCallingCards;
 	bool							mWearables;
 	bool							mIsLoading;
+	bool							mShowDescendantsCount;
 	LLTimer							mTimeSinceRequestStart;
     std::string                     mMessage;
 	LLRootHandle<LLFolderBridge> mHandle;
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 8b50e4248e2ad2b3c409cc6a9249fb56a3c5a4a1..e056ccebee5b8753e4fb4bf97c923fb0832c4d8b 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1178,7 +1178,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
     int incoming_folder_depth = get_folder_levels(inv_cat);
     // Compute the nested folders level we're inserting ourselves in
     // Note: add 1 when inserting under a listing folder as we need to take the root listing folder in the count
-    int insertion_point_folder_depth = (root_folder ? get_folder_path_length(root_folder->getUUID(), dest_folder->getUUID()) + 1 : 0);
+    int insertion_point_folder_depth = (root_folder ? get_folder_path_length(root_folder->getUUID(), dest_folder->getUUID()) + 1 : 1);
 
     // Get the version folder: that's where the folders and items counts start from
     const LLViewerInventoryCategory * version_folder = (insertion_point_folder_depth >= 2 ? gInventory.getFirstDescendantOf(root_folder->getUUID(), dest_folder->getUUID()) : NULL);
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 054db2a3ec11b5bfb914896804e4f98969cc4d58..6a1ec9f9912e84b764d93d18de9bf3227b2e3f8a 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -617,6 +617,11 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
 		return LLUUID::null;
 	}
 
+	if (!gMessageSystem)
+	{
+		return LLUUID::null;
+	}
+
 	// Add the category to the internal representation
 	LLPointer<LLViewerInventoryCategory> cat =
 		new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID());
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index d610b920b9d9f3f39065262c9ef05c50a98861c9..93269db3800efb4e36c9e33c82d729030e6f941a 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -563,6 +563,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 				{
 					setSelection(item_id, FALSE);
 				}
+				updateFolderLabel(model_item->getParentUUID());
 			}
 
 			//////////////////////////////
@@ -574,6 +575,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 				// Don't process the item if it is the root
 				if (old_parent)
 				{
+					LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem());
 					LLFolderViewFolder* new_parent =   (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
 					// Item has been moved.
 					if (old_parent != new_parent)
@@ -591,6 +593,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 									setSelection(item_id, FALSE);
 								}
 							}
+							updateFolderLabel(model_item->getParentUUID());
 						}
 						else 
 						{
@@ -602,6 +605,10 @@ void LLInventoryPanel::modelChanged(U32 mask)
 							// doesn't include trash).  Just remove the item's UI.
 							view_item->destroyView();
 						}
+						if(viewmodel_folder)
+						{
+							updateFolderLabel(viewmodel_folder->getUUID());
+						}
 						old_parent->getViewModelItem()->dirtyDescendantsFilter();
 					}
 				}
@@ -619,6 +626,11 @@ void LLInventoryPanel::modelChanged(U32 mask)
 				if(parent)
 				{
 					parent->getViewModelItem()->dirtyDescendantsFilter();
+					LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem());
+					if(viewmodel_folder)
+					{
+						updateFolderLabel(viewmodel_folder->getUUID());
+					}
 				}
 			}
 		}
@@ -1110,6 +1122,73 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it
 			fv->startRenamingSelectedItem();
 		}
 	}
+
+	std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
+	LLFolderViewItem* prev_folder_item = getItemByID(mPreviousSelectedFolder);
+
+	if (selected_items.size() == 1)
+	{
+		std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin();
+		LLFolderViewItem* folder_item = (*iter);
+		if(folder_item && (folder_item != prev_folder_item))
+		{
+			LLFolderViewModelItemInventory* fve_listener = static_cast<LLFolderViewModelItemInventory*>(folder_item->getViewModelItem());
+			if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
+			{
+				if(prev_folder_item)
+				{
+					LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
+					if(prev_bridge)
+					{
+						prev_bridge->clearDisplayName();
+						prev_bridge->setShowDescendantsCount(false);
+						prev_folder_item->refresh();
+					}
+				}
+
+				LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+				if(bridge)
+				{
+					bridge->clearDisplayName();
+					bridge->setShowDescendantsCount(true);
+					folder_item->refresh();
+					mPreviousSelectedFolder = bridge->getUUID();
+				}
+			}
+		}
+	}
+	else
+	{
+		if(prev_folder_item)
+		{
+			LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
+			if(prev_bridge)
+			{
+				prev_bridge->clearDisplayName();
+				prev_bridge->setShowDescendantsCount(false);
+				prev_folder_item->refresh();
+			}
+		}
+		mPreviousSelectedFolder = LLUUID();
+	}
+
+}
+
+void LLInventoryPanel::updateFolderLabel(const LLUUID& folder_id)
+{
+	if(folder_id != mPreviousSelectedFolder) return;
+
+	LLFolderViewItem* folder_item = getItemByID(mPreviousSelectedFolder);
+	if(folder_item)
+	{
+		LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+		if(bridge)
+		{
+			bridge->clearDisplayName();
+			bridge->setShowDescendantsCount(true);
+			folder_item->refresh();
+		}
+	}
 }
 
 void LLInventoryPanel::doCreate(const LLSD& userdata)
@@ -1364,10 +1443,12 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
 }
 
 //static
-void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id, BOOL main_panel)
+void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id, BOOL main_panel, BOOL take_keyboard_focus, BOOL reset_filter)
 {
 	LLInventoryPanel *active_panel;
-	if (main_panel)
+	bool in_inbox = (gInventory.isObjectDescendentOf(obj_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX)));
+
+	if (main_panel && !in_inbox)
 	{
 		LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory")->selectAllItemsPanel();
 	}
@@ -1376,42 +1457,22 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
 	if (active_panel)
 	{
 		LL_DEBUGS("Messaging") << "Highlighting" << obj_id  << LL_ENDL;
-		
-		LLViewerInventoryItem * item = gInventory.getItem(obj_id);
-		LLViewerInventoryCategory * cat = gInventory.getCategory(obj_id);
-		
-		bool in_inbox = false;
-		
-		LLViewerInventoryCategory * parent_cat = NULL;
-		
-		if (item)
-		{
-			parent_cat = gInventory.getCategory(item->getParentUUID());
-		}
-		else if (cat)
-		{
-			parent_cat = gInventory.getCategory(cat->getParentUUID());
-		}
-		
-		if (parent_cat)
+
+		if (reset_filter)
 		{
-			in_inbox = (LLFolderType::FT_INBOX == parent_cat->getPreferredType());
+			reset_inventory_filter();
 		}
-		
+
 		if (in_inbox)
 		{
 			LLSidepanelInventory * sidepanel_inventory =	LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
 			LLInventoryPanel * inventory_panel = NULL;
-			
-			if (in_inbox)
-			{
-				sidepanel_inventory->openInbox();
-				inventory_panel = sidepanel_inventory->getInboxPanel();
-			}
+			sidepanel_inventory->openInbox();
+			inventory_panel = sidepanel_inventory->getInboxPanel();
 
 			if (inventory_panel)
 			{
-				inventory_panel->setSelection(obj_id, TAKE_FOCUS_YES);
+				inventory_panel->setSelection(obj_id, take_keyboard_focus);
 			}
 		}
 		else
@@ -1421,7 +1482,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
 			{
 				floater_inventory->setFocus(TRUE);
 			}
-			active_panel->setSelection(obj_id, TAKE_FOCUS_YES);
+			active_panel->setSelection(obj_id, take_keyboard_focus);
 		}
 	}
 }
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index d849647bb6ccc0a010d11b85a7ebae56f6bd8f1d..12001f5a2be5c16eece14e57fe6659d92137dc03 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -209,6 +209,8 @@ class LLInventoryPanel : public LLPanel
 	bool attachObject(const LLSD& userdata);
 	static void idle(void* user_data);
 
+	void updateFolderLabel(const LLUUID& folder_id);
+
 	// DEBUG ONLY:
 	static void dumpSelectionInformation(void* user_data);
 
@@ -220,8 +222,12 @@ class LLInventoryPanel : public LLPanel
 	// Find whichever inventory panel is active / on top.
 	// "Auto_open" determines if we open an inventory panel if none are open.
 	static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE);
-	
-	static void openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id, BOOL main_panel = FALSE);
+
+	static void openInventoryPanelAndSetSelection(BOOL auto_open,
+													const LLUUID& obj_id,
+													BOOL main_panel = FALSE,
+													BOOL take_keyboard_focus = TAKE_FOCUS_YES,
+													BOOL reset_filter = FALSE);
 
 	void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
 	void removeItemID(const LLUUID& id);
@@ -254,6 +260,8 @@ class LLInventoryPanel : public LLPanel
 	LLHandle<LLFolderView>      mFolderRoot;
 	LLScrollContainer*			mScroller;
 
+	LLUUID						mPreviousSelectedFolder;
+
 	LLFolderViewModelInventory	mInventoryViewModel;
     LLPointer<LLFolderViewGroupedItemBridge> mGroupedItemBridge;
 	Params						mParams;	// stored copy of parameter block
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index ccbe13fb50c7ebf30eeead15561cdbe818d877e3..d9fc489b4ee071bc26bd686d067f6eb403dd89d8 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -410,9 +410,10 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI
 	std::istringstream content_stream(content_string);
 
 	LLSD response_data;
-	if (!unzip_llsd(response_data, content_stream, content_binary.size()))
+	U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size());
+	if (uzip_result != LLUZipHelper::ZR_OK)
 	{
-		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
+		LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
 		return;
 	}
 
@@ -452,9 +453,10 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL
 	std::istringstream content_stream(content_string);
 
 	LLSD response_data;
-	if (!unzip_llsd(response_data, content_stream, content_binary.size()))
+	U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size());
+	if (uzip_result != LLUZipHelper::ZR_OK)
 	{
-		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
+		LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
 		return;
 	}
 
@@ -520,9 +522,10 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
 	std::istringstream content_stream(content_string);
 
 	LLSD response_data;
-	if (!unzip_llsd(response_data, content_stream, content_binary.size()))
+	U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_stream, content_binary.size());
+	if (uzip_result != LLUZipHelper::ZR_OK)
 	{
-		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
+		LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL;
 		return;
 	}
 	else
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index df708013fc8aae3d5264afa293497497310df2e3..fdaa28b22b42d056c25f2b5242d0fb133b872d39 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1224,7 +1224,12 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
 				LLMeshRepository::sCacheBytesRead += size;
 				++LLMeshRepository::sCacheReads;
 				file.seek(offset);
-				U8* buffer = new U8[size];
+				U8* buffer = new(std::nothrow) U8[size];
+				if (!buffer)
+				{
+					LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info" << LL_ENDL;
+					return false;
+				}
 				file.read(buffer, size);
 
 				//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
@@ -1316,7 +1321,12 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
 				++LLMeshRepository::sCacheReads;
 
 				file.seek(offset);
-				U8* buffer = new U8[size];
+				U8* buffer = new(std::nothrow) U8[size];
+				if (!buffer)
+				{
+					LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition" << LL_ENDL;
+					return false;
+				}
 				file.read(buffer, size);
 
 				//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
@@ -1407,7 +1417,12 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
 				LLMeshRepository::sCacheBytesRead += size;
 				++LLMeshRepository::sCacheReads;
 				file.seek(offset);
-				U8* buffer = new U8[size];
+				U8* buffer = new(std::nothrow) U8[size];
+				if (!buffer)
+				{
+					LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape" << LL_ENDL;
+					return false;
+				}
 				file.read(buffer, size);
 
 				//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
@@ -1727,8 +1742,17 @@ bool LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_params, S32 lod, U
 	}
 
 	LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
-	std::string mesh_string((char*) data, data_size);
-	std::istringstream stream(mesh_string);
+	std::istringstream stream;
+	try
+	{
+		std::string mesh_string((char*)data, data_size);
+		stream.str(mesh_string);
+	}
+	catch (std::bad_alloc)
+	{
+		// out of memory, we won't be able to process this mesh
+		return false;
+	}
 
 	if (volume->unpackVolumeFaces(stream, data_size))
 	{
@@ -1756,9 +1780,11 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat
 
 		std::istringstream stream(res_str);
 
-		if (!unzip_llsd(skin, stream, data_size))
+		U32 uzip_result = LLUZipHelper::unzip_llsd(skin, stream, data_size);
+		if (uzip_result != LLUZipHelper::ZR_OK)
 		{
 			LL_WARNS(LOG_MESH) << "Mesh skin info parse error.  Not a valid mesh asset!  ID:  " << mesh_id
+							   << " uzip result" << uzip_result
 							   << LL_ENDL;
 			return false;
 		}
@@ -1788,9 +1814,11 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3
 
 		std::istringstream stream(res_str);
 
-		if (!unzip_llsd(decomp, stream, data_size))
+		U32 uzip_result = LLUZipHelper::unzip_llsd(decomp, stream, data_size);
+		if (uzip_result != LLUZipHelper::ZR_OK)
 		{
 			LL_WARNS(LOG_MESH) << "Mesh decomposition parse error.  Not a valid mesh asset!  ID:  " << mesh_id
+							   << " uzip result: " << uzip_result
 							   << LL_ENDL;
 			return false;
 		}
@@ -2918,9 +2946,12 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo
 			// handler, optional first that takes a body, fallback second
 			// that requires a temporary allocation and data copy.
 			body_offset = mOffset - offset;
-			data = new U8[data_size - body_offset];
-			body->read(body_offset, (char *) data, data_size - body_offset);
-			LLMeshRepository::sBytesReceived += data_size;
+			data = new(std::nothrow) U8[data_size - body_offset];
+			if (data)
+			{
+				body->read(body_offset, (char *) data, data_size - body_offset);
+				LLMeshRepository::sBytesReceived += data_size;
+			}
 		}
 
 		processData(body, body_offset, data, data_size - body_offset);
@@ -2969,7 +3000,9 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
 									  U8 * data, S32 data_size)
 {
 	LLUUID mesh_id = mMeshParams.getSculptID();
-	bool success = (! MESH_HEADER_PROCESS_FAILED) && gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size);
+	bool success = (! MESH_HEADER_PROCESS_FAILED)
+		&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+		&& gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size);
 	llassert(success);
 	if (! success)
 	{
@@ -3093,7 +3126,9 @@ void LLMeshLODHandler::processFailure(LLCore::HttpStatus status)
 void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
 								   U8 * data, S32 data_size)
 {
-	if ((! MESH_LOD_PROCESS_FAILED) && gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size))
+	if ((!MESH_LOD_PROCESS_FAILED)
+		&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+		&& gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size))
 	{
 		// good fetch from sim, write to VFS for caching
 		LLVFile file(gVFS, mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLVFile::WRITE);
@@ -3141,7 +3176,9 @@ void LLMeshSkinInfoHandler::processFailure(LLCore::HttpStatus status)
 void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
 										U8 * data, S32 data_size)
 {
-	if ((! MESH_SKIN_INFO_PROCESS_FAILED) && gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size))
+	if ((!MESH_SKIN_INFO_PROCESS_FAILED)
+		&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+		&& gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size))
 	{
 		// good fetch from sim, write to VFS for caching
 		LLVFile file(gVFS, mMeshID, LLAssetType::AT_MESH, LLVFile::WRITE);
@@ -3187,7 +3224,9 @@ void LLMeshDecompositionHandler::processFailure(LLCore::HttpStatus status)
 void LLMeshDecompositionHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
 											 U8 * data, S32 data_size)
 {
-	if ((! MESH_DECOMP_PROCESS_FAILED) && gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size))
+	if ((!MESH_DECOMP_PROCESS_FAILED)
+		&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+		&& gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size))
 	{
 		// good fetch from sim, write to VFS for caching
 		LLVFile file(gVFS, mMeshID, LLAssetType::AT_MESH, LLVFile::WRITE);
@@ -3232,7 +3271,9 @@ void LLMeshPhysicsShapeHandler::processFailure(LLCore::HttpStatus status)
 void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
 											U8 * data, S32 data_size)
 {
-	if ((! MESH_PHYS_SHAPE_PROCESS_FAILED) && gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size))
+	if ((!MESH_PHYS_SHAPE_PROCESS_FAILED)
+		&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
+		&& gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size))
 	{
 		// good fetch from sim, write to VFS for caching
 		LLVFile file(gVFS, mMeshID, LLAssetType::AT_MESH, LLVFile::WRITE);
@@ -4827,26 +4868,32 @@ void on_new_single_inventory_upload_complete(
         gInventory.notifyObservers();
         success = true;
 
+        LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
+
         // Show the preview panel for textures and sounds to let
         // user know that the image (or snapshot) arrived intact.
-        LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel();
+        LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
         if (panel)
         {
-            LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
 
             panel->setSelection(
                 server_response["new_inventory_item"].asUUID(),
                 TAKE_FOCUS_NO);
-
-            // restore keyboard focus
-            gFocusMgr.setKeyboardFocus(focus);
         }
+        else
+        {
+            LLInventoryPanel::openInventoryPanelAndSetSelection(TRUE, server_response["new_inventory_item"].asUUID(), TRUE, TAKE_FOCUS_NO, TRUE);
+        }
+
+        // restore keyboard focus
+        gFocusMgr.setKeyboardFocus(focus);
     }
     else
     {
         LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
     }
 
+    // Todo: This is mesh repository code, is following code really needed?
     // remove the "Uploading..." message
     LLUploadDialog::modalUploadFinished();
 
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp
index bf1716e18c701999e4f44b8f891d3cf14a787b6e..64df449c2699793b3b0655d2d9684c03cf487289 100644
--- a/indra/newview/llmutelist.cpp
+++ b/indra/newview/llmutelist.cpp
@@ -316,14 +316,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags)
 				updateAdd(localmute);
 				notifyObservers();
 				notifyObserversDetailed(localmute);
-				if(!(localmute.mFlags & LLMute::flagParticles))
-				{
-					//Kill all particle systems owned by muted task
-					if(localmute.mType == LLMute::AGENT || localmute.mType == LLMute::OBJECT)
-					{
-						LLViewerPartSim::getInstance()->clearParticlesByOwnerID(localmute.mID);
-					}
-				}
+
 				//mute local lights that are attached to the avatar
 				LLVOAvatar *avatarp = find_avatar(localmute.mID);
 				if (avatarp)
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index f87ce8aa52e3dcf458c8e6d876cb1e880a7eeab0..e2157f985e619224977ef8fad4d1a9cab9150eda 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -995,7 +995,8 @@ void LLOutfitListBase::deselectOutfit(const LLUUID& category_id)
     // Reset selection if the outfit is selected.
     if (category_id == mSelectedOutfitUUID)
     {
-        signalSelectionOutfitUUID(LLUUID::null);
+        mSelectedOutfitUUID = LLUUID::null;
+        signalSelectionOutfitUUID(mSelectedOutfitUUID);
     }
 }
 
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 0bcbdf7e67ba019dd49869b2a4247ba4b20fdbb3..c876c1c149cb9f4e5e6f9632522c76048210cfde 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -299,12 +299,24 @@ void LLPanelLogin::addFavoritesToStartLocation()
 
 	// Load favorites into the combo.
 	std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
+	LLStringUtil::toLower(user_defined_name);
 	std::replace(user_defined_name.begin(), user_defined_name.end(), '.', ' ');
 	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml");
 	std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
 	mUsernameLength = user_defined_name.length();
 	updateLoginButtons();
 
+	std::string::size_type index = user_defined_name.find(' ');
+	if (index != std::string::npos)
+	{
+		std::string username = user_defined_name.substr(0, index);
+		std::string lastname = user_defined_name.substr(index+1);
+		if (lastname == "resident")
+		{
+			user_defined_name = username;
+		}
+	}
+
 	LLSD fav_llsd;
 	llifstream file;
 	file.open(filename.c_str());
@@ -492,7 +504,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
 	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
 	if(authenticator.isMap() && 
 	   authenticator.has("secret") && 
-	   (authenticator["secret"].asString().size() > 0))
+	   (authenticator["secret"].asString().size() > 0) && remember)
 	{
 		
 		// This is a MD5 hex digest of a password.
@@ -801,7 +813,8 @@ void LLPanelLogin::loadLoginPage()
 	params["login_content_version"] = gSavedSettings.getString("LoginContentVersion");
 
 	// Make an LLURI with this augmented info
-	LLURI login_uri(LLURI::buildHTTP(login_page.authority(),
+	std::string url = login_page.scheme().empty()? login_page.authority() : login_page.scheme() + "://" + login_page.authority();
+	LLURI login_uri(LLURI::buildHTTP(url,
 									 login_page.path(),
 									 params));
 
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index ec80ff8de7f7fe4dcc071d1d8ec22f4e7ff3c32a..db9d61c637bc13babd0ad935fd5a5545023dd6f6 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -44,6 +44,7 @@
 #include "llfloaterreg.h"
 #include "llmenubutton.h"
 #include "lloutfitobserver.h"
+#include "llpanelmarketplaceinbox.h"
 #include "llpreviewtexture.h"
 #include "llresmgr.h"
 #include "llscrollcontainer.h"
@@ -178,7 +179,9 @@ BOOL LLPanelMainInventory::postBuild()
 		mWornItemsPanel->setFilterWorn();
 		mWornItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
 		mWornItemsPanel->setFilterLinks(LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS);
-		mWornItemsPanel->getFilter().markDefault();
+		LLInventoryFilter& worn_filter = mWornItemsPanel->getFilter();
+		worn_filter.setFilterCategoryTypes(worn_filter.getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
+		worn_filter.markDefault();
 		mWornItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mWornItemsPanel, _1, _2));
 	}
 	mSearchTypeCombo  = getChild<LLComboBox>("search_type");
@@ -483,7 +486,7 @@ void LLPanelMainInventory::onClearSearch()
 	if (mActivePanel && (getActivePanel() != mWornItemsPanel))
 	{
 		initially_active = mActivePanel->getFilter().isNotDefault();
-		mActivePanel->setFilterSubString(LLStringUtil::null);
+		setFilterSubString(LLStringUtil::null);
 		mActivePanel->setFilterTypes(0xffffffffffffffffULL);
 		mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
 	}
@@ -503,6 +506,16 @@ void LLPanelMainInventory::onClearSearch()
 		mActivePanel->getRootFolder()->scrollToShowSelection();
 	}
 	mFilterSubString = "";
+
+	LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+	if (sidepanel_inventory)
+	{
+		LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
+		if (inbox_panel)
+		{
+			inbox_panel->onClearSearch();
+		}
+	}
 }
 
 void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
@@ -534,6 +547,16 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
 
 	// set new filter string
 	setFilterSubString(mFilterSubString);
+
+	LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+	if (sidepanel_inventory)
+	{
+		LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
+		if (inbox_panel)
+		{
+			inbox_panel->onFilterEdit(search_string);
+		}
+	}
 }
 
 
@@ -685,8 +708,17 @@ void LLPanelMainInventory::updateItemcountText()
 		LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
 	}
 
+	if(mCategoryCount != gInventory.getCategoryCount())
+	{
+		mCategoryCount = gInventory.getCategoryCount();
+		mCategoryCountString = "";
+		LLLocale locale(LLLocale::USER_LOCALE);
+		LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount);
+	}
+
 	LLStringUtil::format_map_t string_args;
 	string_args["[ITEM_COUNT]"] = mItemCountString;
+	string_args["[CATEGORY_COUNT]"] = mCategoryCountString;
 	string_args["[FILTER]"] = getFilterText();
 
 	std::string text = "";
@@ -705,6 +737,7 @@ void LLPanelMainInventory::updateItemcountText()
 	}
 	
     mCounterCtrl->setValue(text);
+    mCounterCtrl->setToolTip(text);
 }
 
 void LLPanelMainInventory::onFocusReceived()
@@ -848,7 +881,6 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
 
 	// Get data needed for filter display
 	U32 filter_types = mFilter->getFilterObjectTypes();
-	std::string filter_string = mFilter->getFilterSubString();
 	LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState();
 	U32 hours = mFilter->getHoursAgo();
 	U32 date_search_direction = mFilter->getDateSearchDirection();
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index 2904d5de76dcd0b801a313245415475a11c09ada..732a3b04e3dc92e56a5433c6f59248c33c35b9a3 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -132,7 +132,7 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
 
 	LLFilterEditor*				mFilterEditor;
 	LLTabContainer*				mFilterTabs;
-    LLUICtrl*                   mCounterCtrl;
+	LLUICtrl*					mCounterCtrl;
 	LLHandle<LLFloater>			mFinderHandle;
 	LLInventoryPanel*			mActivePanel;
 	LLInventoryPanel*			mWornItemsPanel;
@@ -141,7 +141,9 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
 	std::string					mFilterText;
 	std::string					mFilterSubString;
 	S32							mItemCount;
-	std::string 				mItemCountString;
+	std::string					mItemCountString;
+	S32							mCategoryCount;
+	std::string					mCategoryCountString;
 	LLComboBox*					mSearchTypeCombo;
 
 
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 79e079f6bdfb95f2b1a776eb480d651c4f6eff4a..8a86f4f63d2f43931c9267affb2c978594d7e9d1 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -51,11 +51,15 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
 	, mFreshCountCtrl(NULL)
 	, mInboxButton(NULL)
 	, mInventoryPanel(NULL)
+	, mSavedFolderState(NULL)
 {
+	mSavedFolderState = new LLSaveFolderState();
+	mSavedFolderState->setApply(FALSE);
 }
 
 LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox()
 {
+	delete mSavedFolderState;
 }
 
 // virtual
@@ -96,6 +100,7 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel()
 	// Set the sort order newest to oldest
 	mInventoryPanel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_DATE);
 	mInventoryPanel->getFilter().markDefault();
+	mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
 
 	// Set selection callback for proper update of inventory status buttons
 	mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
@@ -193,6 +198,38 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const
 	return item_count;
 }
 
+void LLPanelMarketplaceInbox::onClearSearch()
+{
+	if (mInventoryPanel)
+	{
+		mInventoryPanel->setFilterSubString(LLStringUtil::null);
+		mSavedFolderState->setApply(TRUE);
+		mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+		LLOpenFoldersWithSelection opener;
+		mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
+		mInventoryPanel->getRootFolder()->scrollToShowSelection();
+	}
+}
+
+void LLPanelMarketplaceInbox::onFilterEdit(const std::string& search_string)
+{
+	if (mInventoryPanel)
+	{
+
+		if (search_string == "")
+		{
+			onClearSearch();
+		}
+
+		if (!mInventoryPanel->getFilter().isNotDefault())
+		{
+			mSavedFolderState->setApply(FALSE);
+			mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+		}
+		mInventoryPanel->setFilterSubString(search_string);
+	}
+}
+
 std::string LLPanelMarketplaceInbox::getBadgeString() const
 {
 	std::string item_count_str("");
diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h
index 9eb74581a2fd56de8f846949f0e5ab1435770959..952e3a333a3ede214d04651ff49c3cbd06bb4da2 100644
--- a/indra/newview/llpanelmarketplaceinbox.h
+++ b/indra/newview/llpanelmarketplaceinbox.h
@@ -28,7 +28,7 @@
 #define LL_LLPANELMARKETPLACEINBOX_H
 
 #include "llpanel.h"
-
+#include "llfolderview.h"
 class LLButton;
 class LLInventoryPanel;
 class LLUICtrl;
@@ -56,6 +56,9 @@ class LLPanelMarketplaceInbox : public LLPanel
 	
 	LLInventoryPanel * setupInventoryPanel();
 
+	void onClearSearch();
+	void onFilterEdit(const std::string& search_string);
+
 	U32 getFreshItemCount() const;
 	U32 getTotalItemCount() const;
 
@@ -71,6 +74,7 @@ class LLPanelMarketplaceInbox : public LLPanel
 	LLUICtrl *			mFreshCountCtrl;
 	LLButton *			mInboxButton;
 	LLInventoryPanel *	mInventoryPanel;
+	LLSaveFolderState*			mSavedFolderState;
 };
 
 
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp
index c5fda3c1367ad2620e9a9d24af3aa949aa1588cd..2d2ba30e9b26ec51983eaffcada50c7d1a160e5e 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp
@@ -62,6 +62,12 @@ LLInboxInventoryPanel::LLInboxInventoryPanel(const LLInboxInventoryPanel::Params
 LLInboxInventoryPanel::~LLInboxInventoryPanel()
 {}
 
+void LLInboxInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
+{
+	LLInventoryPanel::initFromParams(params);
+	getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX));
+}
+
 LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop)
 {
 	LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
@@ -140,18 +146,16 @@ void LLInboxFolderViewFolder::draw()
 	LLFolderViewFolder::draw();
 }
 
-void LLInboxFolderViewFolder::selectItem()
+BOOL LLInboxFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask )
 {
 	deFreshify();
-
-	LLFolderViewFolder::selectItem();
+	return LLFolderViewFolder::handleMouseDown(x, y, mask);
 }
 
-void LLInboxFolderViewFolder::toggleOpen()
+BOOL LLInboxFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask )
 {
 	deFreshify();
-
-	LLFolderViewFolder::toggleOpen();
+	return LLFolderViewFolder::handleDoubleClick(x, y, mask);
 }
 
 void LLInboxFolderViewFolder::computeFreshness()
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h
index 66aafe83d16f92813d30dd00d3a17110c92f3e70..d398cdafed9cc2fcdbeb2d83dd1473add7cd358f 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.h
+++ b/indra/newview/llpanelmarketplaceinboxinventory.h
@@ -46,6 +46,7 @@ class LLInboxInventoryPanel : public LLInventoryPanel
 	~LLInboxInventoryPanel();
 
 	// virtual
+	void initFromParams(const LLInventoryPanel::Params&);
 	LLFolderViewFolder*	createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop);
 	LLFolderViewItem * createFolderViewItem(LLInvFVBridge * bridge);
 };
@@ -68,8 +69,8 @@ class LLInboxFolderViewFolder : public LLFolderViewFolder, public LLBadgeOwner
     void addItem(LLFolderViewItem* item);
 	void draw();
 	
-	void selectItem();
-	void toggleOpen();
+	BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+	BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
 
 	void computeFreshness();
 	void deFreshify();
diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp
index d7c43c224c8e002b5e3e24503478ca7bd157545e..352218984230d669a9e940e2156067efd4550084 100644
--- a/indra/newview/llpanelmediasettingsgeneral.cpp
+++ b/indra/newview/llpanelmediasettingsgeneral.cpp
@@ -196,7 +196,7 @@ void LLPanelMediaSettingsGeneral::draw()
 
 ////////////////////////////////////////////////////////////////////////////////
 // static 
-void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable)
+void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable, bool update_preview)
 {	
 	LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
 	self->mAutoLoop->clear();
@@ -217,7 +217,10 @@ void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable)
 	self->mHeightPixels ->setEnabled(editable);
 	self->mHomeURL ->setEnabled(editable);
 	self->mWidthPixels ->setEnabled(editable);
-	self->updateMediaPreview();
+	if (update_preview)
+	{
+		self->updateMediaPreview();
+	}
 }
 
 // static
diff --git a/indra/newview/llpanelmediasettingsgeneral.h b/indra/newview/llpanelmediasettingsgeneral.h
index 0ae1401ab23373d1fd7e52296feb5b6ef7dcfbb7..06793d91fc80816820659b8ca6c2f8856d0826dd 100644
--- a/indra/newview/llpanelmediasettingsgeneral.h
+++ b/indra/newview/llpanelmediasettingsgeneral.h
@@ -59,7 +59,7 @@ class LLPanelMediaSettingsGeneral : public LLPanel
 
 	void setParent( LLFloaterMediaSettings* parent );
 	static void initValues( void* userdata, const LLSD& media_settings ,bool editable);
-	static void clearValues( void* userdata, bool editable);
+	static void clearValues( void* userdata, bool editable, bool update_preview = true);
 	
 	// Navigates the current selected face to the Home URL.
 	// If 'only_if_current_is_empty' is "true", it only performs
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index ed942fc7fc52c42acee0cf76ff1f601db4ba7221..48dd45480e8d9efa630f7548252fc482cd59e2f6 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -395,11 +395,16 @@ void LLPanelPlaces::onOpen(const LLSD& key)
 			mPlaceInfoType = key_type;
 			mPosGlobal.setZero();
 			mItem = NULL;
+			mRegionId.setNull();
 			togglePlaceInfoPanel(TRUE);
 
 			if (mPlaceInfoType == AGENT_INFO_TYPE)
 			{
 				mPlaceProfile->setInfoType(LLPanelPlaceInfo::AGENT);
+				if (gAgent.getRegion())
+				{
+					mRegionId = gAgent.getRegion()->getRegionID();
+				}
 			}
 			else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE)
 			{
@@ -472,6 +477,8 @@ void LLPanelPlaces::onOpen(const LLSD& key)
 	if (!parcel_mgr)
 		return;
 
+	mParcelLocalId = parcel_mgr->getAgentParcel()->getLocalID();
+
 	// Start using LLViewerParcelMgr for land selection if
 	// information about nearby land is requested.
 	// Otherwise stop using land selection and deselect land.
@@ -828,10 +835,21 @@ void LLPanelPlaces::onOverflowButtonClicked()
 	{
 		menu = mPlaceMenu;
 
+		bool landmark_item_enabled = false;
+		LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+		if (is_agent_place_info_visible
+			&& gAgent.getRegion()
+			&& mRegionId == gAgent.getRegion()->getRegionID()
+			&& parcel_mgr
+			&& parcel_mgr->getAgentParcel()->getLocalID() == mParcelLocalId)
+		{
+			// Floater still shows location identical to agent's position
+			landmark_item_enabled = !LLLandmarkActions::landmarkAlreadyExists();
+		}
+
 		// Enable adding a landmark only for agent current parcel and if
 		// there is no landmark already pointing to that parcel in agent's inventory.
-		menu->getChild<LLMenuItemCallGL>("landmark")->setEnabled(is_agent_place_info_visible &&
-																 !LLLandmarkActions::landmarkAlreadyExists());
+		menu->getChild<LLMenuItemCallGL>("landmark")->setEnabled(landmark_item_enabled);
 		// STORM-411
 		// Creating landmarks for remote locations is impossible.
 		// So hide menu item "Make a Landmark" in "Teleport History Profile" panel.
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index c3d1b9bc534bb05e6acb16dfb3fd930d13363e98..27f991c202a2f8cb7985ac5dc63075b3c3372498 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -146,6 +146,10 @@ class LLPanelPlaces : public LLPanel
 	// Information type currently shown in Place Information panel
 	std::string					mPlaceInfoType;
 
+	// Region and parcel ids, to detect location changes in case of AGENT_INFO_TYPE
+	LLUUID						mRegionId;
+	S32							mParcelLocalId;
+
 	bool						isLandmarkEditModeOn;
 
 	// Holds info whether "My Landmarks" and "Teleport History" tabs have been created.
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index 15d39c231fecbee888880847bea654e7f941ff2d..08d734ddac11e5840ef13ef5cb273936eedb6d3c 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -44,7 +44,7 @@ typedef std::map<std::string, std::string> controller_map_t;
 typedef std::map<std::string, F32> default_controller_map_t;
 
 #define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f
-#define TIME_ITERATION_STEP 0.1f
+#define TIME_ITERATION_STEP 0.05f
 
 inline F64 llsgn(const F64 a)
 {
@@ -491,12 +491,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
         //
 
         const F32 time_delta = time - mLastTime;
-
-	// Don't update too frequently, to avoid precision errors from small time slices.
-	if (time_delta <= .01)
-	{
-		return FALSE;
-	}
 	
 	// If less than 1FPS, we don't want to be spending time updating physics at all.
         if (time_delta > 1.0)
@@ -555,6 +549,18 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
 	
 	// Break up the physics into a bunch of iterations so that differing framerates will show
 	// roughly the same behavior.
+	// Explanation/example: Lets assume we have a bouncing object. Said abjects bounces at a
+	// trajectory that has points A>B>C. Object bounces from A to B with specific speed.
+	// It needs time T to move from A to B.
+	// As long as our frame's time significantly smaller then T our motion will be split into
+	// multiple parts. with each part speed will decrease. Object will reach B position (roughly)
+	// and bounce/fall back to A.
+	// But if frame's time (F_T) is larger then T, object will move with same speed for whole F_T
+	// and will jump over point B up to C ending up with increased amplitude. To avoid that we
+	// split F_T into smaller portions so that when frame's time is too long object can virtually
+	// bounce at right (relatively) position.
+	// Note: this doesn't look to be optimal, since it provides only "roughly same" behavior, but
+	// irregularity at higher fps looks to be insignificant so it works good enough for low fps.
 	for (F32 time_iteration = 0; time_iteration <= time_delta; time_iteration += TIME_ITERATION_STEP)
 	{
 		F32 time_iteration_step = TIME_ITERATION_STEP;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 358fb80af752a42e32e168ba36ba204b38155fdf..8c5cad5af03ab001febf795a7646693e4b989ef5 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -718,7 +718,6 @@ bool idle_startup()
 		set_startup_status(0.03f, msg.c_str(), gAgent.mMOTD.c_str());
 		display_startup();
 		// LLViewerMedia::initBrowser();
-		show_release_notes_if_required();
 		LLStartUp::setStartupState( STATE_LOGIN_SHOW );
 		return FALSE;
 	}
@@ -749,6 +748,7 @@ bool idle_startup()
 			initialize_spellcheck_menu();
 			init_menus();
 		}
+		show_release_notes_if_required();
 
 		if (show_connect_box)
 		{
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 371da5d0a280c5802539cb1208dc359136b2d491..dadf2f97019d98d36fa1205e36692a10ac83fbf6 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -452,27 +452,38 @@ bool LLTextureCacheRemoteWorker::doRead()
 		size = llmin(size, mDataSize);
 		// Allocate the read buffer
 		mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), size);
-		S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, 
-											 mReadData, offset, size, mCache->getLocalAPRFilePool());
-		if (bytes_read != size)
+		if (mReadData)
+		{
+			S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, 
+												 mReadData, offset, size, mCache->getLocalAPRFilePool());
+			if (bytes_read != size)
+			{
+				LL_WARNS() << "LLTextureCacheWorker: "  << mID
+						<< " incorrect number of bytes read from header: " << bytes_read
+						<< " / " << size << LL_ENDL;
+				FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
+				mReadData = NULL;
+				mDataSize = -1; // failed
+				done = true;
+			}
+			// If we already read all we expected, we're actually done
+			if (mDataSize <= bytes_read)
+			{
+				done = true;
+			}
+			else
+			{
+				mState = BODY;
+			}
+		}
+		else
 		{
 			LL_WARNS() << "LLTextureCacheWorker: "  << mID
-					<< " incorrect number of bytes read from header: " << bytes_read
-					<< " / " << size << LL_ENDL;
-			FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
+				<< " failed to allocate memory for reading: " << mDataSize << LL_ENDL;
 			mReadData = NULL;
 			mDataSize = -1; // failed
 			done = true;
 		}
-		// If we already read all we expected, we're actually done
-		if (mDataSize <= bytes_read)
-		{
-			done = true;
-		}
-		else
-		{
-			mState = BODY;
-		}
 	}
 
 	// Fourth state / stage : read the rest of the data from the UUID based cached file
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index f917faadd4326542a06626ff2076cc817fdffbdf..1f7796e6d0954c569da637bc1e52ee64734d6f14 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1760,7 +1760,17 @@ bool LLTextureFetchWorker::doWork(S32 param)
 				mRequestedSize -= src_offset;			// Make requested values reflect useful part
 				mRequestedOffset += src_offset;
 			}
-			
+
+			U8 * buffer = (U8 *)ALLOCATE_MEM(LLImageBase::getPrivatePool(), total_size);
+			if (!buffer)
+			{
+				// abort. If we have no space for packet, we have not enough space to decode image
+				setState(DONE);
+				LL_WARNS(LOG_TXT) << mID << " abort: out of memory" << LL_ENDL;
+				releaseHttpSemaphore();
+				return true;
+			}
+
 			if (mFormattedImage.isNull())
 			{
 				// For now, create formatted image based on extension
@@ -1780,10 +1790,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
 			{
 				mFileSize = total_size + 1 ; //flag the file is not fully loaded.
 			}
-			
-			U8 * buffer = (U8 *) ALLOCATE_MEM(LLImageBase::getPrivatePool(), total_size);
+
 			if (cur_size > 0)
 			{
+				// Copy previously collected data into buffer
 				memcpy(buffer, mFormattedImage->getData(), cur_size);
 			}
 			mHttpBufferArray->read(src_offset, (char *) buffer + cur_size, append_size);
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 01b4fcfbe170c5cf64892bdc16fc84cde5b8cfde..4f68c9a98ee958fc6b733f33f046a173ab3e0f12 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -760,17 +760,22 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
         {
             success = true;
 
+            LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
+
             // Show the preview panel for textures and sounds to let
             // user know that the image (or snapshot) arrived intact.
-            LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel();
+            LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
             if (panel)
             {
-                LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
                 panel->setSelection(serverInventoryItem, TAKE_FOCUS_NO);
-
-                // restore keyboard focus
-                gFocusMgr.setKeyboardFocus(focus);
             }
+            else
+            {
+                LLInventoryPanel::openInventoryPanelAndSetSelection(TRUE, serverInventoryItem, TRUE, TAKE_FOCUS_NO, TRUE);
+            }
+
+            // restore keyboard focus
+            gFocusMgr.setKeyboardFocus(focus);
         }
         else
         {
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index c015648fa46ad9d3a016784f89b06c0c656ee535..422c1a2328fa0653179a56fec9b9264bd6fe6dca 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -776,13 +776,24 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
 				}
 			}
 			// update the audio stream here as well
+			static bool restore_parcel_audio = false;
 			if( !inworld_audio_enabled)
 			{
 				if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
 				{
 					LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
+					restore_parcel_audio = true;
 				}
 			}
+            else
+            {
+                if(gAudiop && LLViewerMedia::hasParcelAudio() && restore_parcel_audio && gSavedSettings.getBOOL("MediaTentativeAutoPlay"))
+                {
+                    LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
+                    restore_parcel_audio = false;
+                }
+            }
+
 			pimpl->setPriority(new_priority);
 
 			if(pimpl->getUsedInUI())
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 94a86a7831c57b089b85e785091f629955afcbca..e9085f932779f9dd73e280fa6914c3e5296ecf34 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -871,7 +871,7 @@ class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetO
 	 */
 	bool isSelectionChanged()
 	{	
-		LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get());
+		LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel();
 
 		if (NULL == active_panel)
 		{
@@ -881,7 +881,7 @@ class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetO
 		// get selected items (without destination folder)
 		selected_items_t selected_items;
  		
- 		std::set<LLFolderViewItem*> selection =    LLInventoryPanel::getActiveInventoryPanel()->getRootFolder()->getSelectionList();
+		std::set<LLFolderViewItem*> selection = active_panel->getRootFolder()->getSelectionList();
 		for (std::set<LLFolderViewItem*>::iterator it = selection.begin(),    end_it = selection.end();
 			it != end_it;
 			++it)
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 6c2d4d7fea8458d36fc8f211e9e44e7f563ddc2a..5d49c888cfc00bfa77ae83fd1a38a2bd5e34e05c 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -270,7 +270,9 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mPhysicsShapeUnknown(true),
 	mAttachmentItemID(LLUUID::null),
 	mLastUpdateType(OUT_UNKNOWN),
-	mLastUpdateCached(FALSE)
+	mLastUpdateCached(FALSE),
+	mCachedMuteListUpdateTime(0),
+	mCachedOwnerInMuteList(false)
 {
 	if (!is_global)
 	{
@@ -5116,6 +5118,30 @@ void LLViewerObject::updateText()
 	}
 }
 
+bool LLViewerObject::isOwnerInMuteList(LLUUID id)
+{
+	LLUUID owner_id = id.isNull() ? mOwnerID : id;
+	if (isAvatar() || owner_id.isNull())
+	{
+		return false;
+	}
+	bool muted = false;
+	F64 now = LLFrameTimer::getTotalSeconds();
+	if (now < mCachedMuteListUpdateTime)
+	{
+		muted = mCachedOwnerInMuteList;
+	}
+	else
+	{
+		muted = LLMuteList::getInstance()->isMuted(owner_id);
+
+		const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1;
+		mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES;
+		mCachedOwnerInMuteList = muted;
+	}
+	return muted;
+}
+
 LLVOAvatar* LLViewerObject::asAvatar()
 {
 	return NULL;
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 7a490f69570d4ac2c4a887592bbd1ccc2c2ac0af..21c95d55335b71a82f42ea929ab46b113125d3ad 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -422,6 +422,8 @@ class LLViewerObject
 	void updateText(); // update text label position
 	virtual void updateDrawable(BOOL force_damped); // force updates on static objects
 
+	bool isOwnerInMuteList(LLUUID item_id = LLUUID());
+
 	void setDrawableState(U32 state, BOOL recursive = TRUE);
 	void clearDrawableState(U32 state, BOOL recursive = TRUE);
 	BOOL isDrawableState(U32 state, BOOL recursive = TRUE) const;
@@ -823,6 +825,9 @@ class LLViewerObject
 	static BOOL sVelocityInterpolate;
 	static BOOL sPingInterpolate;
 
+	bool mCachedOwnerInMuteList;
+	F64 mCachedMuteListUpdateTime;
+
 	//--------------------------------------------------------------------
 	// For objects that are attachments
 	//--------------------------------------------------------------------
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 3c83e3a0063b4fa7c1ee61c0b6317434b4473bc3..dc54346d59ca35618d863d244160b777f93f2caf 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -478,15 +478,25 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			{
 				U32 flags = 0;
 				mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
-                
-				if(flags & FLAGS_TEMPORARY_ON_REZ)
+
+				compressed_dp.unpackUUID(fullid, "ID");
+				compressed_dp.unpackU32(local_id, "LocalID");
+				compressed_dp.unpackU8(pcode, "PCode");
+				
+				if (pcode == 0)
 				{
-                    compressed_dp.unpackUUID(fullid, "ID");
-                    compressed_dp.unpackU32(local_id, "LocalID");
-                    compressed_dp.unpackU8(pcode, "PCode");
-                }
-				else //send to object cache
+					// object creation will fail, LLViewerObject::createObject()
+					LL_WARNS() << "Received object " << fullid
+						<< " with 0 PCode. Local id: " << local_id
+						<< " Flags: " << flags
+						<< " Region: " << regionp->getName()
+						<< " Region id: " << regionp->getRegionID() << LL_ENDL;
+					recorder.objectUpdateFailure(local_id, update_type, msg_size);
+					continue;
+				}
+				else if ((flags & FLAGS_TEMPORARY_ON_REZ) == 0)
 				{
+					//send to object cache
 					regionp->cacheFullUpdate(compressed_dp, flags);
 					continue;
 				}
@@ -732,9 +742,9 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
 	S32 num_updates, max_value;
 	if (NUM_BINS - 1 == mCurBin)
 	{
+		// Remainder (mObjects.size() could have changed)
 		num_updates = (S32) mObjects.size() - mCurLazyUpdateIndex;
 		max_value = (S32) mObjects.size();
-		gTextureList.setUpdateStats(TRUE);
 	}
 	else
 	{
@@ -791,10 +801,14 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
 	mCurLazyUpdateIndex = max_value;
 	if (mCurLazyUpdateIndex == mObjects.size())
 	{
+		// restart
 		mCurLazyUpdateIndex = 0;
+		mCurBin = 0; // keep in sync with index (mObjects.size() could have changed)
+	}
+	else
+	{
+		mCurBin = (mCurBin + 1) % NUM_BINS;
 	}
-
-	mCurBin = (mCurBin + 1) % NUM_BINS;
 
 	LLVOAvatar::cullAvatarsByPixelArea();
 }
diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp
index b4617566ac73a783b282224e93fa714afb1fe992..25cf082751fd02ce4a84fa2b0ef2aefd2d9fd24b 100644
--- a/indra/newview/llviewerpartsim.cpp
+++ b/indra/newview/llviewerpartsim.cpp
@@ -37,6 +37,7 @@
 #include "llviewerregion.h"
 #include "llvopartgroup.h"
 #include "llworld.h"
+#include "llmutelist.h"
 #include "pipeline.h"
 #include "llspatialpartition.h"
 #include "llvoavatarself.h"
@@ -711,6 +712,11 @@ void LLViewerPartSim::updateSimulation()
 				upd = FALSE;
 			}
 
+			if(vobj && vobj->isOwnerInMuteList(mViewerPartSources[i]->getOwnerUUID()))
+			{
+				upd = FALSE;
+			}
+
 			if (upd && vobj && (vobj->getPCode() == LL_PCODE_VOLUME))
 			{
 				if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex())
@@ -750,7 +756,7 @@ void LLViewerPartSim::updateSimulation()
 		LLViewerObject* vobj = mViewerPartGroups[i]->mVOPartGroupp;
 
 		S32 visirate = 1;
-		if (vobj)
+		if (vobj && !vobj->isDead() && vobj->mDrawable && !vobj->mDrawable->isDead())
 		{
 			LLSpatialGroup* group = vobj->mDrawable->getSpatialGroup();
 			if (group && !group->isVisible()) // && !group->isState(LLSpatialGroup::OBJECT_DIRTY))
@@ -761,7 +767,7 @@ void LLViewerPartSim::updateSimulation()
 
 		if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0)
 		{
-			if (vobj)
+			if (vobj && !vobj->isDead())
 			{
 				gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
 			}
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 0a3012ffefe568fc644fc688bd0ac27166c9a4a6..45ea169fb8ee50ac3a81dad2217f5f301b63c6a5 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -92,7 +92,6 @@ LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type)
 
 LLViewerTextureList::LLViewerTextureList() 
 	: mForceResetTextureStats(FALSE),
-	mUpdateStats(FALSE),
 	mMaxResidentTexMemInMegaBytes(0),
 	mMaxTotalTextureMemInMegaBytes(0),
 	mInitialized(FALSE)
@@ -103,7 +102,6 @@ void LLViewerTextureList::init()
 {			
 	mInitialized = TRUE ;
 	sNumImages = 0;
-	mUpdateStats = TRUE;
 	mMaxResidentTexMemInMegaBytes = (U32Bytes)0;
 	mMaxTotalTextureMemInMegaBytes = (U32Bytes)0;
 	
@@ -1171,7 +1169,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
 
 void LLViewerTextureList::updateImagesUpdateStats()
 {
-	if (mUpdateStats && mForceResetTextureStats)
+	if (mForceResetTextureStats)
 	{
 		for (image_priority_list_t::iterator iter = mImageList.begin();
 			 iter != mImageList.end(); )
@@ -1179,7 +1177,6 @@ void LLViewerTextureList::updateImagesUpdateStats()
 			LLViewerFetchedTexture* imagep = *iter++;
 			imagep->resetTextureStats();
 		}
-		mUpdateStats = FALSE;
 		mForceResetTextureStats = FALSE;
 	}
 }
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index 070544063ac5854b3ae9ef8e4fb82c2438625e0a..281d23c671c862e11b58ddd7c11d8ae029535ab1 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -124,8 +124,6 @@ class LLViewerTextureList
 
 	void handleIRCallback(void **data, const S32 number);
 
-	void setUpdateStats(BOOL b)			{ mUpdateStats = b; }
-
 	S32Megabytes	getMaxResidentTexMem() const	{ return mMaxResidentTexMemInMegaBytes; }
 	S32Megabytes getMaxTotalTextureMem() const   { return mMaxTotalTextureMemInMegaBytes;}
 	S32 getNumImages()					{ return mImageList.size(); }
@@ -224,7 +222,6 @@ class LLViewerTextureList
 	std::set<LLPointer<LLViewerFetchedTexture> > mImagePreloads;
 
 	BOOL mInitialized ;
-	BOOL mUpdateStats;
 	S32Megabytes	mMaxResidentTexMemInMegaBytes;
 	S32Megabytes mMaxTotalTextureMemInMegaBytes;
 	LLFrameTimer mForceDecodeTimer;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 119c1a9db67545da8d36d42b6da259b8d9c53c3e..74deaffe168c4b2cff7e5bfa66623145b2f97b40 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1406,7 +1406,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
 	LLVoiceClient::getInstance()->keyDown(key, mask);
-	
+
 	if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME)
 	{
 		gAgent.clearAFK();
@@ -1959,7 +1959,11 @@ void LLViewerWindow::initBase()
 	// (But wait to add it as a child of the root view so that it will be in front of the 
 	// other views.)
 	MainPanel* main_view = new MainPanel();
-	main_view->buildFromFile("main_view.xml");
+	if (!main_view->buildFromFile("main_view.xml"))
+	{
+		LL_ERRS() << "Failed to initialize viewer: Viewer couldn't process file main_view.xml, "
+				<< "if this problem happens again, please validate your installation." << LL_ENDL;
+	}
 	main_view->setShape(full_window);
 	getRootView()->addChild(main_view);
 
@@ -2264,6 +2268,7 @@ void LLViewerWindow::shutdownGL()
 LLViewerWindow::~LLViewerWindow()
 {
 	LL_INFOS() << "Destroying Window" << LL_ENDL;
+	gDebugWindowProc = TRUE; // event catching, at this point it shouldn't output at all
 	destroyWindow();
 
 	delete mDebugText;
@@ -4443,7 +4448,8 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picke
 		err = LLFile::stat( filepath, &stat_info );
 		i++;
 	}
-	while( -1 != err );  // search until the file is not found (i.e., stat() gives an error).
+	while( -1 != err  // Search until the file is not found (i.e., stat() gives an error).
+			&& is_snapshot_name_loc_set); // Or stop if we are rewriting.
 
 	LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL;
 	return image->save(filepath);
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 627b83818fe9986dcd5be28b4dabbe8851d13624..6e5a5e3084cb25f67c784158fe4d1f784302158e 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -887,13 +887,8 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
 bool LLVivoxVoiceClient::provisionVoiceAccount()
 {
     LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL;
-    while (!gAgent.getRegion())
-    {
-        // *TODO* Set up a call back on agent that sends a message to a pump we can use to wake up.
-        llcoro::suspend();
-    }
 
-    while (!gAgent.getRegion()->capabilitiesReceived())
+    while (!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived())
     {
         // *TODO* Pump a message for wake up.
         llcoro::suspend();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index f77b48ff8075c3b63868898a795dad363e6abbff..7b4d8ef3299318bc0e2b043f7b7d340aa8a58fb9 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -628,7 +628,7 @@ void LLVOVolume::updateTextures()
 		if (mDrawable.notNull() && !isVisible() && !mDrawable->isActive())
 		{ //delete vertex buffer to free up some VRAM
 			LLSpatialGroup* group  = mDrawable->getSpatialGroup();
-			if (group)
+			if (group && (group->mVertexBuffer.notNull() || !group->mBufferMap.empty() || !group->mDrawMap.empty()))
 			{
 				group->destroyGL(true);
 
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index ee2270c3236fa0faac9a3a741f6f4d88d21511ea..5fb3d6244593b625db504c566cf857bdeeaf61c7 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -645,7 +645,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
 		setRightMouseDownCallback(boost::bind(&LLWearableItemsList::onRightClick, this, _2, _3));
 	}
 	mWornIndicationEnabled = p.worn_indication_enabled;
-	setNoItemsCommentText(LLTrans::getString("LoadingData"));
+	setNoItemsCommentText(LLTrans::getString("NoneFound"));
 }
 
 // virtual
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 62fad322467a1387af688ae0f98d4774956d77ac..9ae788a40910a4b6c002ee2ba61462f3221565e0 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1750,8 +1750,10 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
 		case MAP_ITEM_LAND_FOR_SALE:
 		case MAP_ITEM_LAND_FOR_SALE_ADULT:
 			{
+				LLVector3d pos_global = viewPosToGlobal(x, y);
+				LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
 				LLFloaterReg::hideInstance("world_map");
-				LLFloaterReg::showInstance("search", LLSD().with("category", "destinations").with("query", id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "land").with("query", info->getName()));
 				break;
 			}
 		case MAP_ITEM_CLASSIFIED:
diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
index dddb258ed9260f6a4ccf1df6662a54006d482abb..af6d11f47e406e8a03aeba6b27ce26dfc1b2bd45 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
@@ -47,7 +47,6 @@
      top="20"
      width="500">
         <panel
-         border="none"
          height="150"
          label="Search"
          layout="topleft"
@@ -108,7 +107,6 @@
           </scroll_list>
         </panel>
         <panel
-         border="none"
          height="150"
          label="Friends"
          layout="topleft"
@@ -144,7 +142,6 @@
             <scroll_list
              follows="all"
              height="120"
-             border="false"
              layout="topleft"
              left="0"
              name="Friends"
@@ -154,7 +151,6 @@
         </panel>
 
         <panel
-         border="none"
          height="150"
          label="Near Me"
          layout="topleft"
@@ -213,7 +209,6 @@
              draw_heading="true"
              follows="all"
              height="100"
-             border="false"
              layout="topleft"
              left="0"
              name="NearMe"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 9e4cb4e267d8e92083e8a845ab63f5a6df86b9a4..6aa6653f424f80e3b590b7ecc49499d4ca4eeb38 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -5928,7 +5928,7 @@ The folder &apos;[FOLDERNAME]&apos; is a system folder. Deleting system folders
    icon="alertmodal.tga"
    name="ConfirmEmptyTrash"
    type="alertmodal">
-[COUNT] items will be permanently deleted. Are you sure you want to permanently delete the contents of your Trash?
+[COUNT] items and folders will be permanently deleted. Are you sure you want to permanently delete the contents of your Trash?
     <tag>confirm</tag>
     <usetemplate
      name="okcancelbuttons"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index df7039859939380327058890d54099c58640c101..d77fbdec0ac28dd95c9c4ddfdaa169e3fb02ed17 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -13,26 +13,27 @@
   </panel.string>
   <panel.string
    name="ItemcountFetching">
-    Fetching [ITEM_COUNT] Items... [FILTER]
+    Fetching [ITEM_COUNT] Items and [CATEGORY_COUNT] Folders... [FILTER]
   </panel.string>
   <panel.string
    name="ItemcountCompleted">
-    [ITEM_COUNT] Items [FILTER]
+    [ITEM_COUNT] Items and [CATEGORY_COUNT] Folders [FILTER]
   </panel.string>
   <panel.string
    name="ItemcountUnknown">
-    Fetched [ITEM_COUNT] Items [FILTER]
+    Fetched [ITEM_COUNT] Items and [CATEGORY_COUNT] Folders [FILTER]
   </panel.string>
   <text
 		     type="string"
 		     length="1"
-		     follows="left|top"
+		     follows="left|top|right"
 		     height="13"
 		     layout="topleft"
     		 left="12"
 		     name="ItemcountText"
 		     font="SansSerifMedium"
 		     text_color="EmphasisColor"
+		     use_ellipses="true"
 		     top_pad="0"
 		     width="300">
     Items:
diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml
index 4d9316768b05d0614b1c1be197f3bb7612e7f16d..c1a68fb9af46a12237ccfc73b96335bdf622271c 100644
--- a/indra/newview/skins/default/xui/en/panel_notification.xml
+++ b/indra/newview/skins/default/xui/en/panel_notification.xml
@@ -71,7 +71,6 @@
       mouse_opaque="false"
       name="text_editor_box"
       read_only="true"
-      tab_stop="false"
       text_color="White"
       text_readonly_color="White"
       top="10"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 807d116b3b6d6d961ff36df45f78f9fe6043782e..5f30a7e87d157282d51b3b2bc600e00ae13668f5 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2329,7 +2329,7 @@ If you continue to receive this message, please contact Second Life support for
 	<string name="InventoryMarketplaceListingsNoItems">
         Drag folders to this area to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace].
 	</string>
-
+	<string name="InventoryItemsCount">( [ITEMS_COUNT] Items )</string>
 	<string name="Marketplace Validation Log"></string>
 	<string name="Marketplace Validation Warning Stock">stock folder must be contained by a version folder</string>
 	<string name="Marketplace Validation Error Mixed Stock">: Error: all items in a stock folder must be no-copy and of the same type</string>