diff --git a/.hgtags b/.hgtags
index 30e96d4a18f4475ff323fa05db5909b224c67d8c..aeb1ebadeaedb2e0ce790bed3b467146df7c8288 100755
--- a/.hgtags
+++ b/.hgtags
@@ -475,3 +475,5 @@ d40c66e410741de7e90b1ed6dac28dd8a2d7e1f6 3.6.8-release
 5d746de933a98ca17887cde2fece80e9c7ab0b98 3.7.0-release
 dcb4981ce255841b6083d8f65444b65d5a733a17 3.7.1-release
 b842534cb4d76c9ef87676a62b1d2d19e79c015f 3.7.2-release
+962d3f98955bfc7310a7867c8cbc3df075e54aa9 3.7.3-release
+d076568ff7883b41c149e6afb421f39c29dbfe2b 3.7.4-release
diff --git a/BuildParams b/BuildParams
index ede2595cd349f5ad78c6d3230b7342c3d067a09b..7a6542dadcb959326a30bba1cd7a253af9ecef99 100755
--- a/BuildParams
+++ b/BuildParams
@@ -49,17 +49,11 @@ viewer_channel = "Second Life Test"
 
 # Setup default packaging parameters.
 sourceid = ""
-additional_packages = "Amazon Desura A B C"
+additional_packages = "Amazon Desura"
 Amazon_sourceid = "1207v_Amazon"
 Amazon_viewer_channel_suffix = "Amazon"
 Desura_sourceid = "1208_desura"
 Desura_viewer_channel_suffix = "Desura"
-A_sourceid = "1300_A"
-A_viewer_channel_suffix = "A"
-B_sourceid = "1301_B"
-B_viewer_channel_suffix = "B"
-C_sourceid = "1302_C"
-C_viewer_channel_suffix = "C"
 
 # Report changes since...
 viewer-development.show_changes_since = last_sprint
diff --git a/autobuild.xml b/autobuild.xml
index 3affa6d5e70a3a0c99be3165c8549d86599d1c0c..080bc63563d1c35459f5e52de3c843d7cbc2846f 100755
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -498,9 +498,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>10352aab979c333a52dbad21b6e6fba9</string>
+              <string>862b9244ed8a27bec16b62883fe3580a</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmodex-private/rev/274403/arch/Darwin/installer/fmodex-4.44-darwin-20130419.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmodex-private/rev/288122/arch/Darwin/installer/fmodex-4.44.31-darwin-20140314.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -510,9 +510,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>79e45527aa9fb90b813599dff5ce01a7</string>
+              <string>180f4d703deec104469e6a9044243110</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmodex-private/rev/274378/arch/Linux/installer/fmodex-4.44-linux-20130419.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmodex-private/rev/288122/arch/Linux/installer/fmodex-4.44.31-linux-20140315.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
@@ -522,9 +522,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>91752db72202807cffb33c1ec3fd90fc</string>
+              <string>6c859cd17fb8c9cdd96b188c2a2c2838</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmodex-private/rev/276321/arch/CYGWIN/installer/fmodex-4.44-windows-20130521.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-fmodex-private/rev/288122/arch/CYGWIN/installer/fmodex-4.44.31-windows-20140314.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index 44c2d3ac27b8bf460b15b8623de7f7314f268813..f98e88b6970960ff253b0da34e17aff09e5a36fe 100755
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -64,6 +64,7 @@ if(WINDOWS)
     endif(USE_TCMALLOC)
 
     if (FMODEX)
+      set(debug_files ${debug_files} fmodexL.dll)
       set(release_files ${release_files} fmodex.dll)
     endif (FMODEX)
 
@@ -294,7 +295,8 @@ elseif(LINUX)
     endif (USE_TCMALLOC)
 
     if (FMODEX)
-      set(release_file ${release_files} "libfmodex.so")
+      set(debug_files ${debug_files} "libfmodexL.so")
+      set(release_files ${release_files} "libfmodex.so")
     endif (FMODEX)
 
 else(WINDOWS)
diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake
index 65bc1cabeb8fd77340ea80cf78d50dd1c7bd5d75..163260137bcf4af312ca0486dcddb1c720b34e6e 100644
--- a/indra/cmake/FMODEX.cmake
+++ b/indra/cmake/FMODEX.cmake
@@ -39,7 +39,7 @@ if (FMODEX)
             optimized fmodex)
       endif (WINDOWS)
       set(FMODEX_LIBRARIES ${FMODEX_LIBRARY})
-      set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodex)
+      set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/)
     endif (FMODEX_LIBRARY AND FMODEX_INCLUDE_DIR)
   endif (STANDALONE)
 endif (FMODEX)
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 3bb759d45879890b3e81b78be9b9db48971d7a0b..0f5d729e77e1bd0662f9b435056acdac1ef07c3b 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -81,6 +81,7 @@ class LLAvatarBoneInfo
 	~LLAvatarBoneInfo()
 	{
 		std::for_each(mChildList.begin(), mChildList.end(), DeletePointer());
+		mChildList.clear();
 	}
 	BOOL parseXml(LLXmlTreeNode* node);
 	
@@ -108,6 +109,7 @@ class LLAvatarSkeletonInfo
 	~LLAvatarSkeletonInfo()
 	{
 		std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer());
+		mBoneInfoList.clear();
 	}
 	BOOL parseXml(LLXmlTreeNode* node);
 	S32 getNumBones() const { return mNumBones; }
@@ -132,14 +134,26 @@ LLAvatarAppearance::LLAvatarXmlInfo::LLAvatarXmlInfo()
 LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo()
 {
 	std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
+	mMeshInfoList.clear();
+
 	std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());		
+	mSkeletalDistortionInfoList.clear();
+
 	std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
+	mAttachmentInfoList.clear();
+
 	deleteAndClear(mTexSkinColorInfo);
 	deleteAndClear(mTexHairColorInfo);
 	deleteAndClear(mTexEyeColorInfo);
+
 	std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());		
+	mLayerInfoList.clear();
+
 	std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
+	mDriverInfoList.clear();
+
 	std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer());
+	mMorphMaskInfoList.clear();
 }
 
 
@@ -291,10 +305,6 @@ LLAvatarAppearance::~LLAvatarAppearance()
 	clearSkeleton();
 	deleteAndClearArray(mCollisionVolumes);
 
-	deleteAndClear(mTexSkinColor);
-	deleteAndClear(mTexHairColor);
-	deleteAndClear(mTexEyeColor);
-
 	std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
 	mPolyMeshes.clear();
 
diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp
index f38b98210422667fcf93b373670e2bfe2ecebdd4..16b0260d1ae3364fde16c34880efbc802befeb27 100644
--- a/indra/llappearance/lltexglobalcolor.cpp
+++ b/indra/llappearance/lltexglobalcolor.cpp
@@ -120,6 +120,7 @@ LLTexGlobalColorInfo::LLTexGlobalColorInfo()
 LLTexGlobalColorInfo::~LLTexGlobalColorInfo()
 {
 	for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
+	mParamColorInfoList.clear();
 }
 
 BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node)
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index a3a86168642666fbe973e8d6fb4e0c83fc9ce132..63d01999f0610c3cc843bc47917d91852e7bb79b 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -195,6 +195,7 @@ LLTexLayerSetInfo::LLTexLayerSetInfo() :
 LLTexLayerSetInfo::~LLTexLayerSetInfo( )
 {
 	std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
+	mLayerInfoList.clear();
 }
 
 BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node)
@@ -282,7 +283,10 @@ LLTexLayerSet::~LLTexLayerSet()
 {
 	deleteCaches();
 	std::for_each(mLayerList.begin(), mLayerList.end(), DeletePointer());
+	mLayerList.clear();
+
 	std::for_each(mMaskLayerList.begin(), mMaskLayerList.end(), DeletePointer());
+	mMaskLayerList.clear();
 }
 
 //-----------------------------------------------------------------------------
@@ -652,7 +656,9 @@ LLTexLayerInfo::LLTexLayerInfo() :
 LLTexLayerInfo::~LLTexLayerInfo( )
 {
 	std::for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
+	mParamColorInfoList.clear();
 	std::for_each(mParamAlphaInfoList.begin(), mParamAlphaInfoList.end(), DeletePointer());
+	mParamAlphaInfoList.clear();
 }
 
 BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp
index e9b74b8f41836985fb356e57e0db680c8b284ef3..36e8044a25f7c6289f3a0738cee39320bff44760 100644
--- a/indra/llaudio/llaudioengine_fmodex.cpp
+++ b/indra/llaudio/llaudioengine_fmodex.cpp
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2014, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -55,11 +55,13 @@ LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
 	mWindDSP = NULL;
 	mSystem = NULL;
 	mEnableProfiler = enable_profiler;
+	mWindDSPDesc = new FMOD_DSP_DESCRIPTION();
 }
 
 
 LLAudioEngine_FMODEX::~LLAudioEngine_FMODEX()
 {
+	delete mWindDSPDesc;
 }
 
 
@@ -320,8 +322,8 @@ void LLAudioEngine_FMODEX::shutdown()
 	llinfos << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << llendl;
 	if ( mSystem ) // speculative fix for MAINT-2657
 	{
-	mSystem->close();
-	mSystem->release();
+		mSystem->close();
+		mSystem->release();
 	}
 	llinfos << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << llendl;
 
@@ -347,15 +349,14 @@ bool LLAudioEngine_FMODEX::initWind()
 
 	if (!mWindDSP)
 	{
-		FMOD_DSP_DESCRIPTION dspdesc;
-		memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION));	//Set everything to zero
-		strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name));	//Set name to "Wind Unit"
-		dspdesc.channels=2;
-		dspdesc.read = &windCallback; //Assign callback.
-		if(Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP"))
+		memset(mWindDSPDesc, 0, sizeof(*mWindDSPDesc));	//Set everything to zero
+		strncpy(mWindDSPDesc->name, "Wind Unit", sizeof(mWindDSPDesc->name));
+		mWindDSPDesc->channels = 2;
+		mWindDSPDesc->read = &windCallback; // Assign callback - may be called from arbitrary threads
+		if (Check_FMOD_Error(mSystem->createDSP(mWindDSPDesc, &mWindDSP), "FMOD::createDSP"))
 			return false;
 
-		if(mWindGen)
+		if (mWindGen)
 			delete mWindGen;
 	
 		float frequency = 44100;
@@ -364,6 +365,7 @@ bool LLAudioEngine_FMODEX::initWind()
 		mWindDSP->setUserData((void*)mWindGen);
 	}
 
+	// *TODO:  Should this guard against multiple plays?
 	if (mWindDSP)
 	{
 		mSystem->playDSP(FMOD_CHANNEL_FREE, mWindDSP, false, 0);
@@ -741,6 +743,9 @@ void LLAudioChannelFMODEX::set3DMode(bool use3d)
 	}
 }
 
+// *NOTE:  This is almost certainly being called on the mixer thread,
+// not the main thread.  May have implications for callees or audio
+// engine shutdown.
 
 FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *originalbuffer, float *newbuffer, unsigned int length, int inchannels, int outchannels)
 {
diff --git a/indra/llaudio/llaudioengine_fmodex.h b/indra/llaudio/llaudioengine_fmodex.h
index 415a9ed0efb7d244bb2d6bcca6a179f9939156a8..ca389d489fd981359e666ae50b250668a7489c90 100644
--- a/indra/llaudio/llaudioengine_fmodex.h
+++ b/indra/llaudio/llaudioengine_fmodex.h
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2014, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -41,6 +41,7 @@ namespace FMOD
 	class Sound;
 	class DSP;
 }
+typedef struct FMOD_DSP_DESCRIPTION FMOD_DSP_DESCRIPTION;
 
 //Interfaces
 class LLAudioEngine_FMODEX : public LLAudioEngine 
@@ -74,6 +75,7 @@ class LLAudioEngine_FMODEX : public LLAudioEngine
 
 	LLWindGen<MIXBUFFERFORMAT> *mWindGen;
 
+	FMOD_DSP_DESCRIPTION *mWindDSPDesc;
 	FMOD::DSP *mWindDSP;
 	FMOD::System *mSystem;
 	bool mEnableProfiler;
diff --git a/indra/llaudio/lllistener_fmodex.cpp b/indra/llaudio/lllistener_fmodex.cpp
index 2509a7aebc9c67bb4e016549377017c1a10dd424..31ab47a635f34d93fd1ee3e85676c785affa0e28 100644
--- a/indra/llaudio/lllistener_fmodex.cpp
+++ b/indra/llaudio/lllistener_fmodex.cpp
@@ -94,6 +94,11 @@ void LLListener_FMODEX::orient(LLVector3 up, LLVector3 at)
 //-----------------------------------------------------------------------
 void LLListener_FMODEX::commitDeferredChanges()
 {
+	if(!mSystem)
+	{
+		return;
+	}
+
 	mSystem->update();
 }
 
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index 2a0df2638491978cfd4e7556f39b9d95383437c7..8c02a2536703b2b0452abd3599624478bce65a8b 100755
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -203,6 +203,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
 LLBVHLoader::~LLBVHLoader()
 {
 	std::for_each(mJoints.begin(),mJoints.end(),DeletePointer());
+	mJoints.clear();
 }
 
 //------------------------------------------------------------------------
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 07ef52228e64a0451c54e7938a1c562f13e5e82a..2241a595139ef95f2d11b9bd5b4cff77634f13dd 100755
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -81,7 +81,9 @@ LLKeyframeMotion::JointMotionList::JointMotionList()
 LLKeyframeMotion::JointMotionList::~JointMotionList()
 {
 	for_each(mConstraints.begin(), mConstraints.end(), DeletePointer());
+	mConstraints.clear();
 	for_each(mJointMotionArray.begin(), mJointMotionArray.end(), DeletePointer());
+	mJointMotionArray.clear();
 }
 
 U32 LLKeyframeMotion::JointMotionList::dumpDiagInfo()
@@ -447,6 +449,7 @@ LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id)
 LLKeyframeMotion::~LLKeyframeMotion()
 {
 	for_each(mConstraints.begin(), mConstraints.end(), DeletePointer());
+	mConstraints.clear();
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp
index e2d284834f0944175e4e475002807a7965d65f9b..411bb094fd12d06606e1b05c04f1591683409f42 100755
--- a/indra/llcharacter/llmultigesture.cpp
+++ b/indra/llcharacter/llmultigesture.cpp
@@ -59,6 +59,7 @@ LLMultiGesture::LLMultiGesture()
 LLMultiGesture::~LLMultiGesture()
 {
 	std::for_each(mSteps.begin(), mSteps.end(), DeletePointer());
+	mSteps.clear();
 }
 
 void LLMultiGesture::reset()
diff --git a/indra/llcharacter/llpose.cpp b/indra/llcharacter/llpose.cpp
index 55e1b6e9eaaf005f48fdac54a9318f82dbb99fa7..b1a7ebb159612bdbde8e68b3178c6c8d2f62d383 100755
--- a/indra/llcharacter/llpose.cpp
+++ b/indra/llcharacter/llpose.cpp
@@ -461,6 +461,7 @@ LLPoseBlender::LLPoseBlender()
 LLPoseBlender::~LLPoseBlender()
 {
 	for_each(mJointStateBlenderPool.begin(), mJointStateBlenderPool.end(), DeletePairedPointer());
+	mJointStateBlenderPool.clear();
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index 642bd82e90947978b33eacbe8eb884d330f8b14c..d12f15791002dccfe538177a743890e98fb9fb1b 100755
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -44,6 +44,7 @@ static const std::string DISPLAY_NAME_EXPIRES("display_name_expires");
 static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update");
 
 bool LLAvatarName::sUseDisplayNames = true;
+bool LLAvatarName::sUseUsernames = true;
 
 // Minimum time-to-live (in seconds) for a name entry.
 // Avatar name should always guarantee to expire reasonably soon by default
@@ -81,6 +82,16 @@ bool LLAvatarName::useDisplayNames()
 	return sUseDisplayNames; 
 }
 
+void LLAvatarName::setUseUsernames(bool use)
+{
+	sUseUsernames = use;
+}
+
+bool LLAvatarName::useUsernames()
+{
+	return sUseUsernames;
+}
+
 LLSD LLAvatarName::asLLSD() const
 {
 	LLSD sd;
@@ -168,7 +179,11 @@ std::string LLAvatarName::getCompleteName() const
 		}
 		else
 		{
-			name = mDisplayName + " (" + mUsername + ")";
+			name = mDisplayName;
+			if(sUseUsernames)
+			{
+				name += " (" + mUsername + ")";
+			}
 		}
 	}
 	else
diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h
index 5d2fccc5bab0ede19a47b9eb10c1bb6c57764930..1cb3ae421f817b2de991b1730bc1b95ee8037d2e 100755
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -54,6 +54,9 @@ class LL_COMMON_API LLAvatarName
 	static void setUseDisplayNames(bool use);
 	static bool useDisplayNames();
 	
+	static void setUseUsernames(bool use);
+	static bool useUsernames();
+
 	// A name object is valid if not temporary and not yet expired (default is expiration not checked)
 	bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); }
 	
@@ -128,6 +131,9 @@ class LL_COMMON_API LLAvatarName
 	// Global flag indicating if display name should be used or not
 	// This will affect the output of the high level "get" methods
 	static bool sUseDisplayNames;
+
+	// Flag indicating if username should be shown after display name or not
+	static bool sUseUsernames;
 };
 
 #endif
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index d2af004cde71a209ae084c0eecd5478f5ab11839..853f279c95aca53e113fda0de32892e79845e45b 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -429,8 +429,8 @@ namespace LLError
 		
 		~Settings()
 		{
-			for_each(recorders.begin(), recorders.end(),
-					 DeletePointer());
+			for_each(recorders.begin(), recorders.end(), DeletePointer());
+			recorders.clear();
 		}
 		
 		static Settings*& getPtr();
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 01b6e60d2b0ace54c3ed94248baa8c608ec7f9af..58db7d0d1784896759a137996f59041edc840684 100755
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -119,6 +119,7 @@ class NamedTimerFactory : public LLSingleton<NamedTimerFactory>
 	~NamedTimerFactory()
 	{
 		std::for_each(mTimers.begin(), mTimers.end(), DeletePairedPointer());
+		mTimers.clear();
 
 		delete mTimerRoot;
 	}
diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h
index d3941e1bc92c30502b0a05989ab4da896d776db5..0a39288f5a0c61e523a6e960ef3d0ca184ff6131 100755
--- a/indra/llcommon/llstl.h
+++ b/indra/llcommon/llstl.h
@@ -98,6 +98,7 @@ struct DeletePointerArray
 // The general form is:
 //
 //  std::for_each(somemap.begin(), somemap.end(), DeletePairedPointer());
+//  somemap.clear();		// Don't leave dangling pointers around
 
 struct DeletePairedPointer
 {
diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp
index fb2d43e3b0d6c25af71214e8cf3f1bbe255198fd..aa66ceb4ecce28bbcab64fc6b497a1e7db2e84b0 100755
--- a/indra/llcrashlogger/llcrashlogger.cpp
+++ b/indra/llcrashlogger/llcrashlogger.cpp
@@ -44,7 +44,7 @@
 #include "llsdserialize.h"
 #include "llproxy.h"
 
-LLPumpIO* gServicePump;
+LLPumpIO* gServicePump = NULL;
 BOOL gBreak = false;
 BOOL gSent = false;
 
@@ -80,7 +80,8 @@ LLCrashLogger::LLCrashLogger() :
 
 LLCrashLogger::~LLCrashLogger()
 {
-
+	delete gServicePump;
+	gServicePump = NULL;
 }
 
 // TRIM_SIZE must remain larger than LINE_SEARCH_SIZE.
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 9a68093427d241b8c8000edfdc18920598333b18..31dd2640218217ae74551c390a940d0ae4435b56 100755
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -680,6 +680,15 @@ void LLAvatarNameCache::setUseDisplayNames(bool use)
 	}
 }
 
+void LLAvatarNameCache::setUseUsernames(bool use)
+{
+	if (use != LLAvatarName::useUsernames())
+	{
+		LLAvatarName::setUseUsernames(use);
+		mUseDisplayNamesSignal();
+	}
+}
+
 void LLAvatarNameCache::erase(const LLUUID& agent_id)
 {
 	sCache.erase(agent_id);
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 2a8eb46187b1af5fbd308fbb551f6fe73f73a85f..3a19cee3ed5e579ffd8571dc518930a9cb198c8b 100755
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -80,6 +80,8 @@ namespace LLAvatarNameCache
 	// Set display name: flips the switch and triggers the callbacks.
 	void setUseDisplayNames(bool use);
 	
+	void setUseUsernames(bool use);
+
 	void insert(const LLUUID& agent_id, const LLAvatarName& av_name);
 	void erase(const LLUUID& agent_id);
 
diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp
index 01da20f06029efc12e828a201f45e48827528ab7..aaa49d2ed64fc9dc0cf51bd3b1106ff86747af40 100755
--- a/indra/llmessage/llbuffer.cpp
+++ b/indra/llmessage/llbuffer.cpp
@@ -225,7 +225,7 @@ LLBufferArray::LLBufferArray() :
 LLBufferArray::~LLBufferArray()
 {
 	std::for_each(mBuffers.begin(), mBuffers.end(), DeletePointer());
-
+	mBuffers.clear();
 	delete mMutexp;
 }
 
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 267c48e1d2d5d692cc36c0792b0854eaa7ef0587..13d779ff83c77b396d96d273ab316b3c6df6ee83 100755
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -278,7 +278,9 @@ LLCacheName::Impl::Impl(LLMessageSystem* msg)
 LLCacheName::Impl::~Impl()
 {
 	for_each(mCache.begin(), mCache.end(), DeletePairedPointer());
+	mCache.clear();
 	for_each(mReplyQueue.begin(), mReplyQueue.end(), DeletePointer());
+	mReplyQueue.clear();
 }
 
 boost::signals2::connection LLCacheName::Impl::addPending(const LLUUID& id, const LLCacheNameCallback& callback)
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 25e175f2cc314d32e2a26fafe733ee84492cf38d..9e68c68858bd4ebf3db255ec33631dcf470c2420 100755
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -1741,6 +1741,7 @@ void LLCurl::cleanupClass()
 #if SAFE_SSL
 	CRYPTO_set_locking_callback(NULL);
 	for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer());
+	sSSLMutex.clear();
 #endif
 	
 	LL_CHECK_MEMORY
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index 5c2f73eccb809bb32e50900ec9fd23f0139b4596..f6ccb5bddab1f4d3dcd653f58e7c7f1f8eda0361 100755
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -76,8 +76,8 @@ LLHTTPNode::LLHTTPNode()
 // virtual
 LLHTTPNode::~LLHTTPNode()
 {
-	std::for_each(impl.mNamedChildren.begin(), impl.mNamedChildren.end(),
-		DeletePairedPointer());
+	std::for_each(impl.mNamedChildren.begin(), impl.mNamedChildren.end(), DeletePairedPointer());
+	impl.mNamedChildren.clear();
 
 	delete impl.mWildcardChild;
 	
diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp
index c48cbc42a6264b9e5ceb6671c46a377f97ad7baf..d0bd343db6ddbb2f0b4c44061bf7863263335359 100755
--- a/indra/llmessage/llhttpsender.cpp
+++ b/indra/llmessage/llhttpsender.cpp
@@ -38,7 +38,7 @@ namespace
 {
 	typedef std::map<LLHost, LLHTTPSender*> SenderMap;
 	static SenderMap senderMap;
-	static LLHTTPSender* defaultSender = new LLHTTPSender();
+	static LLPointer<LLHTTPSender> defaultSender(new LLHTTPSender());
 }
 
 //virtual 
@@ -90,6 +90,5 @@ void LLHTTPSender::clearSender(const LLHost& host)
 //static 
 void LLHTTPSender::setDefaultSender(LLHTTPSender* sender)
 {
-	delete defaultSender;
 	defaultSender = sender;
 }
diff --git a/indra/llmessage/llhttpsender.h b/indra/llmessage/llhttpsender.h
index 88920db24d4c515712179affa83f8774f8e0ca08..ff8fa2f95b16fbfddb136227489118cefd52f4d9 100755
--- a/indra/llmessage/llhttpsender.h
+++ b/indra/llmessage/llhttpsender.h
@@ -32,7 +32,7 @@
 class LLHost;
 class LLSD;
 
-class LLHTTPSender
+class LLHTTPSender : public LLThreadSafeRefCount
 {
  public:
 
diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h
index ae8e0087c14d84c590d2f178ce7b8f2469bcc7e6..005a49cedf22f8c924c267670e652f7ed446726d 100755
--- a/indra/llmessage/llmessagetemplate.h
+++ b/indra/llmessage/llmessagetemplate.h
@@ -118,6 +118,7 @@ class LLMsgData
 	~LLMsgData()
 	{
 		for_each(mMemberBlocks.begin(), mMemberBlocks.end(), DeletePairedPointer());
+		mMemberBlocks.clear();
 	}
 
 	void addBlock(LLMsgBlkData *blockp)
diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp
index ab91f74abe606a31d25bc64dcf215022888d4782..94bc7cb0458455df8b961444c2270de56a8bf597 100755
--- a/indra/llmessage/lltemplatemessagereader.cpp
+++ b/indra/llmessage/lltemplatemessagereader.cpp
@@ -91,15 +91,17 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname
 	}
 
 	LLMsgBlkData *msg_block_data = iter->second;
-	LLMsgVarData& vardata = msg_block_data->mMemberVarData[vnamep];
+	LLMsgBlkData::msg_var_data_map_t &var_data_map = msg_block_data->mMemberVarData;
 
-	if (!vardata.getName())
+	if (var_data_map.find(vnamep) == var_data_map.end())
 	{
 		llerrs << "Variable "<< vnamep << " not in message "
 			<< mCurrentRMessageData->mName<< " block " << bnamep << llendl;
 		return;
 	}
 
+	LLMsgVarData& vardata = msg_block_data->mMemberVarData[vnamep];
+
 	if (size && size != vardata.getSize())
 	{
 		llerrs << "Msg " << mCurrentRMessageData->mName 
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index ae95087377f4fe19197189c6e42c37c14429d536..c3642ccbe85ae1f904364148df7dd7bf090f1cab 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -3032,12 +3032,23 @@ void LLMessageSystem::setExceptionFunc(EMessageException e,
 BOOL LLMessageSystem::callExceptionFunc(EMessageException exception)
 {
 	callbacks_t::iterator it = mExceptionCallbacks.find(exception);
-	if(it != mExceptionCallbacks.end())
+	if(it == mExceptionCallbacks.end())
 	{
-		((*it).second.first)(this, (*it).second.second,exception);
-		return TRUE;
+		return FALSE;
 	}
-	return FALSE;
+
+	exception_t& ex = it->second;
+	msg_exception_callback ex_cb = ex.first;
+
+	if (!ex_cb)
+	{
+		LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << llendl;
+		return FALSE;
+	}
+
+	(ex_cb)(this, ex.second, exception);
+
+	return TRUE;
 }
 
 void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data)
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 058bef43a566079881309508da4a20244ff874b0..84c782e958137a2f6d35f84d0de4fee3dd6939a1 100755
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -125,6 +125,7 @@ LLFontFreetype::~LLFontFreetype()
 
 	// Delete glyph info
 	std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer());
+	mCharGlyphInfoMap.clear();
 
 	// mFontBitmapCachep will be cleaned up by LLPointer destructor.
 	// mFallbackFonts cleaned up by LLPointer destructor
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 0ac30b4d63a52be2763d6fb412525c85a539ef0c..b481cf7095e15c821d2018a1403902f11d120356 100755
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -2196,7 +2196,15 @@ void LLRender::texCoord2fv(const GLfloat* tc)
 
 void LLRender::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a)
 {
-	mColorsp[mCount] = LLColor4U(r,g,b,a);
+	if (!LLGLSLShader::sCurBoundShaderPtr ||
+		LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR)
+	{
+		mColorsp[mCount] = LLColor4U(r,g,b,a);
+	}
+	else
+	{ //not using shaders or shader reads color from a uniform
+		diffuseColor4ub(r,g,b,a);
+	}
 }
 void LLRender::color4ubv(const GLubyte* c)
 {
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 5f69c6af31581b1024312c947e7abe332afbfb47..304d21d0df8cc284205c378eb622331cf0c255fe 100755
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -315,14 +315,15 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask)
 		S32 delta_y = screen_y - mDragLastScreenY;
 
 		// if dragging a docked floater we want to undock
-		if (((LLFloater*)getParent())->isDocked())
+		LLFloater * parent = dynamic_cast<LLFloater *>(getParent());
+		if (parent && parent->isDocked())
 		{
 			const S32 SLOP = 12;
 
 			if (delta_y <= -SLOP || 
 				delta_y >= SLOP)
 			{
-				((LLFloater*)getParent())->setDocked(false, false);
+				parent->setDocked(false, false);
 				return TRUE;
 			}
 			else
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 6e6bcd6ab5ff5819f12ef3a6c58faa9d6562526c..c462b2aa52c2d58867f9ed8863d470d326703859 100755
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -509,8 +509,8 @@ LLFloater::~LLFloater()
 	
 	if( gFocusMgr.childHasKeyboardFocus(this))
 	{
-	// Just in case we might still have focus here, release it.
-	releaseFocus();
+		// Just in case we might still have focus here, release it.
+		releaseFocus();
 	}
 
 	// This is important so that floaters with persistent rects (i.e., those
@@ -528,7 +528,6 @@ LLFloater::~LLFloater()
 	setVisible(false); // We're not visible if we're destroyed
 	storeVisibilityControl();
 	storeDockStateControl();
-
 	delete mMinimizeSignal;
 }
 
@@ -1138,7 +1137,11 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
 
 	if (by_user && !getHost())
 	{
-		static_cast<LLFloaterView*>(getParent())->adjustToFitScreen(this, !isMinimized());
+		LLFloaterView * floaterVp = dynamic_cast<LLFloaterView*>(getParent());
+		if (floaterVp)
+		{
+			floaterVp->adjustToFitScreen(this, !isMinimized());
+		}
 	}
 
 	// if not minimized, adjust all snapped dependents to new shape
@@ -1349,7 +1352,8 @@ void LLFloater::setFocus( BOOL b )
 	if (b)
 	{
 		// only push focused floaters to front of stack if not in midst of ctrl-tab cycle
-		if (!getHost() && !((LLFloaterView*)getParent())->getCycleMode())
+		LLFloaterView * parent = dynamic_cast<LLFloaterView *>(getParent());
+		if (!getHost() && parent && !parent->getCycleMode())
 		{
 			if (!isFrontmost())
 			{
@@ -1619,7 +1623,7 @@ void LLFloater::bringToFront( S32 x, S32 y )
 		}
 		else
 		{
-			LLFloaterView* parent = (LLFloaterView*) getParent();
+			LLFloaterView* parent = dynamic_cast<LLFloaterView*>( getParent() );
 			if (parent)
 			{
 				parent->bringToFront( this );
@@ -1658,7 +1662,11 @@ void LLFloater::setFrontmost(BOOL take_focus)
 	{
 		// there are more than one floater view
 		// so we need to query our parent directly
-		((LLFloaterView*)getParent())->bringToFront(this, take_focus);
+		LLFloaterView * parent = dynamic_cast<LLFloaterView*>( getParent() );
+		if (parent)
+		{
+			parent->bringToFront(this, take_focus);
+		}
 
 		// Make sure to set the appropriate transparency type (STORM-732).
 		updateTransparency(hasFocus() || getIsChrome() ? TT_ACTIVE : TT_INACTIVE);
@@ -1951,6 +1959,7 @@ void	LLFloater::drawShadow(LLPanel* panel)
 
 void LLFloater::updateTransparency(LLView* view, ETypeTransparency transparency_type)
 {
+	if (!view) return;
 	child_list_t children = *view->getChildList();
 	child_list_t::iterator it = children.begin();
 
@@ -2387,6 +2396,9 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
 
 void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
 {
+	if (!child)
+		return;
+
 	if (mFrontChild == child)
 	{
 		if (give_focus && !gFocusMgr.childHasKeyboardFocus(child))
@@ -2742,8 +2754,6 @@ void LLFloaterView::refresh()
 	}
 }
 
-const S32 FLOATER_MIN_VISIBLE_PIXELS = 16;
-
 void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars/* = false*/)
 {
 	if (floater->getParent() != this)
@@ -2796,11 +2806,29 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
 		}
 	}
 
+	const LLRect& floater_rect = floater->getRect();
+
+	S32 delta_left = mToolbarLeftRect.notEmpty() ? mToolbarLeftRect.mRight - floater_rect.mRight : 0;
+	S32 delta_bottom = mToolbarBottomRect.notEmpty() ? mToolbarBottomRect.mTop - floater_rect.mTop : 0;
+	S32 delta_right = mToolbarRightRect.notEmpty() ? mToolbarRightRect.mLeft - floater_rect.mLeft : 0;
+
 	// move window fully onscreen
 	if (floater->translateIntoRect( snap_in_toolbars ? getSnapRect() : gFloaterView->getRect(), allow_partial_outside ? FLOATER_MIN_VISIBLE_PIXELS : S32_MAX ))
 	{
 		floater->clearSnapTarget();
 	}
+	else if (delta_left > 0 && floater_rect.mTop < mToolbarLeftRect.mTop && floater_rect.mBottom > mToolbarLeftRect.mBottom)
+	{
+		floater->translate(delta_left, 0);
+	}
+	else if (delta_bottom > 0 && floater_rect.mLeft > mToolbarBottomRect.mLeft && floater_rect.mRight < mToolbarBottomRect.mRight)
+	{
+		floater->translate(0, delta_bottom);
+	}
+	else if (delta_right < 0 && floater_rect.mTop < mToolbarRightRect.mTop	&& floater_rect.mBottom > mToolbarRightRect.mBottom)
+	{
+		floater->translate(delta_right, 0);
+	}
 }
 
 void LLFloaterView::draw()
@@ -2846,10 +2874,13 @@ LLFloater *LLFloaterView::getFocusedFloater() const
 {
 	for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
 	{
-		LLUICtrl* ctrlp = (*child_it)->isCtrl() ? static_cast<LLUICtrl*>(*child_it) : NULL;
-		if ( ctrlp && ctrlp->hasFocus() )
+		if ((*child_it)->isCtrl())
 		{
-			return static_cast<LLFloater *>(ctrlp);
+			LLFloater* ctrlp = dynamic_cast<LLFloater*>(*child_it);
+			if ( ctrlp && ctrlp->hasFocus() )
+			{
+				return ctrlp;
+			}
 		}
 	}
 	return NULL;
@@ -3000,6 +3031,25 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
 	LLFloaterReg::blockShowFloaters(false);
 }
 
+void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect)
+{
+	switch (tb)
+	{
+	case LLToolBarEnums::TOOLBAR_LEFT:
+		mToolbarLeftRect = toolbar_rect;
+		break;
+	case LLToolBarEnums::TOOLBAR_BOTTOM:
+		mToolbarBottomRect = toolbar_rect;
+		break;
+	case LLToolBarEnums::TOOLBAR_RIGHT:
+		mToolbarRightRect = toolbar_rect;
+		break;
+	default:
+		llwarns << "setToolbarRect() passed odd toolbar number " << (S32) tb << llendl;
+		break;
+	}
+}
+
 void LLFloater::setInstanceName(const std::string& name)
 {
 	if (name != mInstanceName)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 75715ef296b03a26c5b482d55415dba4065f118a..12eb3cdbfafb444b625d0aed57c6cbd70d3a0377 100755
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -32,6 +32,7 @@
 #define LL_FLOATER_H
 
 #include "llpanel.h"
+#include "lltoolbar.h"
 #include "lluuid.h"
 //#include "llnotificationsutil.h"
 #include <set>
@@ -514,6 +515,8 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 // LLFloaterView
 // Parent of all floating panels
 
+const S32 FLOATER_MIN_VISIBLE_PIXELS = 16;
+
 class LLFloaterView : public LLUICtrl
 {
 public:
@@ -572,10 +575,15 @@ class LLFloaterView : public LLUICtrl
 	void setFloaterSnapView(LLHandle<LLView> snap_view) {mSnapView = snap_view; }
 	LLFloater* getFrontmostClosableFloater(); 
 
+	void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect);
+
 private:
 	void hiddenFloaterClosed(LLFloater* floater);
 
 	LLRect				mLastSnapRect;
+	LLRect				mToolbarLeftRect;
+	LLRect				mToolbarBottomRect;
+	LLRect				mToolbarRightRect;
 	LLHandle<LLView>	mSnapView;
 	BOOL			mFocusCycleMode;
 	S32				mSnapOffsetBottom;
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 26d27d1f3456034cf6b60076e46e7e8aa345f43f..39153977bf12168049b4e0ed5cb40c265ae6773e 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -76,8 +76,11 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const
 LLKeywords::~LLKeywords()
 {
 	std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer());
+	mWordTokenMap.clear();
 	std::for_each(mLineTokenList.begin(), mLineTokenList.end(), DeletePointer());
+	mLineTokenList.clear();
 	std::for_each(mDelimiterTokenList.begin(), mDelimiterTokenList.end(), DeletePointer());
+	mDelimiterTokenList.clear();
 }
 
 BOOL LLKeywords::loadFromFile( const std::string& filename )
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index f854e1785d5d816bed315a77d64911beb3e1482c..6a57158eaa59270c6fedb0ed4c78f7760787797f 100755
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -693,8 +693,11 @@ void LLMenuItemTearOffGL::onCommit()
 {
 	if (getMenu()->getTornOff())
 	{
-		LLTearOffMenu* torn_off_menu = (LLTearOffMenu*)(getMenu()->getParent());
-		torn_off_menu->closeFloater();
+		LLTearOffMenu * torn_off_menu = dynamic_cast<LLTearOffMenu*>(getMenu()->getParent());
+		if (torn_off_menu)
+		{
+			torn_off_menu->closeFloater();
+		}
 	}
 	else
 	{
@@ -1097,7 +1100,8 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight )
 
 	BOOL auto_open = getEnabled() && (!branch->getVisible() || branch->getTornOff());
 	// torn off menus don't open sub menus on hover unless they have focus
-	if (getMenu()->getTornOff() && !((LLFloater*)getMenu()->getParent())->hasFocus())
+	LLFloater * menu_parent = dynamic_cast<LLFloater *>(getMenu()->getParent());
+	if (getMenu()->getTornOff() && menu_parent && !menu_parent->hasFocus())
 	{
 		auto_open = FALSE;
 	}
@@ -1118,7 +1122,11 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight )
 	{
 		if (branch->getTornOff())
 		{
-			((LLFloater*)branch->getParent())->setFocus(FALSE);
+			LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent());
+			if (branch_parent)
+			{
+				branch_parent->setFocus(FALSE);
+			}
 			branch->clearHoverItem();
 		}
 		else
@@ -1175,11 +1183,19 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask )
 			BOOL handled = branch->clearHoverItem();
 			if (branch->getTornOff())
 			{
-				((LLFloater*)branch->getParent())->setFocus(FALSE);
+				LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent());
+				if (branch_parent)
+				{
+					branch_parent->setFocus(FALSE);
+				}
 			}
 			if (handled && getMenu()->getTornOff())
 			{
-				((LLFloater*)getMenu()->getParent())->setFocus(TRUE);
+				LLFloater * menu_parent = dynamic_cast<LLFloater *>(getMenu()->getParent());
+				if (menu_parent)
+				{
+					menu_parent->setFocus(TRUE);
+				}
 			}
 			return handled;
 		}
@@ -1219,9 +1235,13 @@ void LLMenuItemBranchGL::openMenu()
 
 	if (branch->getTornOff())
 	{
-		gFloaterView->bringToFront((LLFloater*)branch->getParent());
-		// this might not be necessary, as torn off branches don't get focus and hence no highligth
-		branch->highlightNextItem(NULL);
+		LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent());
+		if (branch_parent)
+		{
+			gFloaterView->bringToFront(branch_parent);
+			// this might not be necessary, as torn off branches don't get focus and hence no highligth
+			branch->highlightNextItem(NULL);
+		}
 	}
 	else if( !branch->getVisible() )
 	{
@@ -1348,7 +1368,11 @@ void LLMenuItemBranchDownGL::openMenu( void )
 	{
 		if (branch->getTornOff())
 		{
-			gFloaterView->bringToFront((LLFloater*)branch->getParent());
+			LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent());
+			if (branch_parent)
+			{
+				gFloaterView->bringToFront(branch_parent);
+			}
 		}
 		else
 		{
@@ -1403,7 +1427,11 @@ void LLMenuItemBranchDownGL::setHighlight( BOOL highlight )
 	{
 		if (branch->getTornOff())
 		{
-			((LLFloater*)branch->getParent())->setFocus(FALSE);
+			LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent());
+			if (branch_parent)
+			{
+				branch_parent->setFocus(FALSE);
+			}
 			branch->clearHoverItem();
 		}
 		else
@@ -1826,20 +1854,28 @@ BOOL LLMenuGL::jumpKeysActive()
 {
 	LLMenuItemGL* highlighted_item = getHighlightedItem();
 	BOOL active = getVisible() && getEnabled();
-	if (getTornOff())
-	{
-		// activation of jump keys on torn off menus controlled by keyboard focus
-		active = active && ((LLFloater*)getParent())->hasFocus();
 
-	}
-	else
+	if (active)
 	{
-		// Are we the terminal active menu?
-		// Yes, if parent menu item deems us to be active (just being visible is sufficient for top-level menus)
-		// and we don't have a highlighted menu item pointing to an active sub-menu
-		active = active && (!getParentMenuItem() || getParentMenuItem()->isActive()) // I have a parent that is active...
-		                && (!highlighted_item || !highlighted_item->isActive()); //... but no child that is active
+		if (getTornOff())
+		{
+			// activation of jump keys on torn off menus controlled by keyboard focus
+			LLFloater * parent = dynamic_cast<LLFloater *>(getParent());
+			if (parent)
+			{
+				active = parent->hasFocus();
+			}
+		}
+		else
+		{
+			// Are we the terminal active menu?
+			// Yes, if parent menu item deems us to be active (just being visible is sufficient for top-level menus)
+			// and we don't have a highlighted menu item pointing to an active sub-menu
+			active = (!getParentMenuItem() || getParentMenuItem()->isActive()) // I have a parent that is active...
+					&& (!highlighted_item || !highlighted_item->isActive()); //... but no child that is active
+		}
 	}
+
 	return active;
 }
 
@@ -1855,7 +1891,12 @@ BOOL LLMenuGL::isOpen()
 			return TRUE;
 		}
 		// otherwise we are only active if we have keyboard focus
-		return ((LLFloater*)getParent())->hasFocus();
+		LLFloater * parent = dynamic_cast<LLFloater *>(getParent());
+		if (parent)
+		{
+			return parent->hasFocus();
+		}
+		return FALSE;
 	}
 	else
 	{
@@ -2714,7 +2755,11 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa
 	// same as giving focus to it
 	if (!cur_item && getTornOff())
 	{
-		((LLFloater*)getParent())->setFocus(TRUE);
+		LLFloater * parent = dynamic_cast<LLFloater *>(getParent());
+		if (parent)
+		{
+			parent->setFocus(TRUE);
+		}
 	}
 
 	// Current item position in the items list
@@ -2816,7 +2861,11 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa
 	// same as giving focus to it
 	if (!cur_item && getTornOff())
 	{
-		((LLFloater*)getParent())->setFocus(TRUE);
+		LLFloater * parent = dynamic_cast<LLFloater *>(getParent());
+		if (parent)
+		{
+			parent->setFocus(TRUE);
+		}
 	}
 
 	// Current item reverse position from the end of the list
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index e63b41f97c56121288d418204658dace49e273ec..17b9b91ba795b9a50a768d2fd2850305af33aa69 100755
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -330,17 +330,16 @@ class LLRegisterPanelClass
 
 // local static instance for registering a particular panel class
 template<typename T>
-class LLRegisterPanelClassWrapper
-:	public LLRegisterPanelClass
+	class LLPanelInjector
 {
 public:
-	// reigister with either the provided builder, or the generic templated builder
-	LLRegisterPanelClassWrapper(const std::string& tag);
+	// register with either the provided builder, or the generic templated builder
+	LLPanelInjector(const std::string& tag);
 };
 
 
 template<typename T>
-LLRegisterPanelClassWrapper<T>::LLRegisterPanelClassWrapper(const std::string& tag) 
+	LLPanelInjector<T>::LLPanelInjector(const std::string& tag) 
 {
 	LLRegisterPanelClass::instance().addPanelClass(tag,&LLRegisterPanelClass::defaultPanelClassBuilder<T>);
 }
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 6e03f604a2f05de05660aae67b6b981205af427d..d4bbea0f8eccc02d8c7370acba80ec37c512c852 100755
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -320,7 +320,9 @@ LLScrollListCtrl::~LLScrollListCtrl()
 	delete mSortCallback;
 
 	std::for_each(mItemList.begin(), mItemList.end(), DeletePointer());
+	mItemList.clear();
 	std::for_each(mColumns.begin(), mColumns.end(), DeletePairedPointer());
+	mColumns.clear();
 }
 
 
@@ -1855,7 +1857,7 @@ void LLScrollListCtrl::showNameDetails(std::string id, bool is_group)
 	// open the resident's details or the group details
 	std::string sltype = is_group ? "group" : "agent";
 	std::string slurl = "secondlife:///app/" + sltype + "/" + id + "/about";
-	LLUrlAction::clickAction(slurl);
+	LLUrlAction::clickAction(slurl, true);
 }
 
 void LLScrollListCtrl::copyNameToClipboard(std::string id, bool is_group)
diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp
index 5a1e96ab034cc74fd1be5aa766c45b7c0b20f8c1..cc7f42e49accfd84159e388fc3696a82340cdacd 100755
--- a/indra/llui/llscrolllistitem.cpp
+++ b/indra/llui/llscrolllistitem.cpp
@@ -50,6 +50,7 @@ LLScrollListItem::LLScrollListItem( const Params& p )
 LLScrollListItem::~LLScrollListItem()
 {
 	std::for_each(mColumns.begin(), mColumns.end(), DeletePointer());
+	mColumns.clear();
 }
 
 void LLScrollListItem::addColumn(const LLScrollListCell::Params& p)
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 76ba53ec329e600084424a110695f7924edc709b..2b9286f6639c980ced85a17c988a267d926ac861 100755
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -281,6 +281,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
 LLTabContainer::~LLTabContainer()
 {
 	std::for_each(mTabList.begin(), mTabList.end(), DeletePointer());
+	mTabList.clear();
 }
 
 //virtual
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 5ec4cf4fe5dd57af6b51e9d1e93365dd4d6b0083..4144a42fd6559e98414843ac6b3c08590d776af7 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -167,6 +167,7 @@ LLTextBase::Params::Params()
 	max_text_length("max_length", 255),
 	font_shadow("font_shadow"),
 	wrap("wrap"),
+	trusted_content("trusted_content", true),
 	use_ellipses("use_ellipses", false),
 	parse_urls("parse_urls", false),
 	parse_highlights("parse_highlights", false)
@@ -211,6 +212,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
 	mLineSpacingPixels(p.line_spacing.pixels),
 	mClip(p.clip),
 	mClipPartial(p.clip_partial && !p.allow_scroll),
+	mTrustedContent(p.trusted_content),
 	mTrackEnd( p.track_end ),
 	mScrollIndex(-1),
 	mSelectionStart( 0 ),
@@ -3164,7 +3166,7 @@ BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask)
 		// Only process the click if it's actually in this segment, not to the right of the end-of-line.
 		if(mEditor.getSegmentAtLocalPos(x, y, false) == this)
 		{
-			LLUrlAction::clickAction(getStyle()->getLinkHREF());
+			LLUrlAction::clickAction(getStyle()->getLinkHREF(), mEditor.isContentTrusted());
 			return TRUE;
 		}
 	}
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index a74e97cac836787d086301241233eecadc224f66..3603f55c3f42b50e730eff57ba8f7a0c3c66673e 100755
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -291,7 +291,8 @@ class LLTextBase
 								parse_urls,
 								parse_highlights,
 								clip,
-								clip_partial;
+								clip_partial,
+								trusted_content;
 								
 		Optional<S32>			v_pad,
 								h_pad;
@@ -361,6 +362,7 @@ class LLTextBase
 	bool					getWordWrap() { return mWordWrap; }
 	bool					getUseEllipses() { return mUseEllipses; }
 	bool					truncate(); // returns true of truncation occurred
+	bool					isContentTrusted() {return mTrustedContent;}
 
 	// TODO: move into LLTextSegment?
 	void					createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url
@@ -634,6 +636,7 @@ class LLTextBase
 	bool						mBGVisible;			// render background?
 	bool						mClip;				// clip text to widget rect
 	bool						mClipPartial;		// false if we show lines that are partially inside bounding rect
+	bool						mTrustedContent;	// if false, does not allow to execute SURL links from this editor
 	bool						mPlainText;			// didn't use Image or Icon segments
 	bool						mAutoIndent;
 	S32							mMaxTextByteLength;	// Maximum length mText is allowed to be in bytes
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 62140dd9d67909de341221f61efaa6f092dad743..02c81c07448db2baa00f39feb0fdd6d1f2e4fc18 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -310,7 +310,7 @@ LLTextEditor::~LLTextEditor()
 
 	// Scrollbar is deleted by LLView
 	std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
-
+	mUndoStack.clear();
 	// context menu is owned by menu holder, not us
 	//delete mContextMenu;
 }
@@ -1620,7 +1620,7 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
 		}
 	}
 
-	if (handled)
+	if (handled && !gFocusMgr.getMouseCapture())
 	{
 		updatePrimary();
 	}
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 928e82cb8c21c798e2cdb1744270ababa2b7012c..ee82e0403b9f67b00ccc33db4945a27637f8d0ae 100755
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -118,7 +118,8 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
 	mButtonLeaveSignal(NULL),
 	mButtonRemoveSignal(NULL),
 	mDragAndDropTarget(false),
-	mCaretIcon(NULL)
+	mCaretIcon(NULL),
+	mCenterPanel(NULL)
 {
 	mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
 	mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon;
@@ -200,14 +201,15 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)
 	center_panel_p.auto_resize = false;
 	center_panel_p.user_resize = false;
 	center_panel_p.mouse_opaque = false;
-	LLLayoutPanel* center_panel = LLUICtrlFactory::create<LLLayoutPanel>(center_panel_p);
-	mCenteringStack->addChild(center_panel);
+	mCenterPanel = LLUICtrlFactory::create<LLCenterLayoutPanel>(center_panel_p);
+	mCenteringStack->addChild(mCenterPanel);
 
 	LLPanel::Params button_panel_p(p.button_panel);
-	button_panel_p.rect = center_panel->getLocalRect();
-		button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT;
+	button_panel_p.rect = mCenterPanel->getLocalRect();
+	button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT;
 	mButtonPanel = LLUICtrlFactory::create<LLPanel>(button_panel_p);
-	center_panel->addChild(mButtonPanel);
+	mCenterPanel->setButtonPanel(mButtonPanel);
+	mCenterPanel->addChild(mButtonPanel);
 	
 	mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p));
 
@@ -1242,3 +1244,15 @@ const std::string LLToolBarButton::getToolTip() const
 	return tooltip;
 }
 
+void LLToolBar::LLCenterLayoutPanel::handleReshape(const LLRect& rect, bool by_user)
+{
+	LLLayoutPanel::handleReshape(rect, by_user);
+
+	if (!mReshapeCallback.empty())
+	{
+		LLRect r;
+		localRectToOtherView(mButtonPanel->getRect(), &r, gFloaterView);
+		r.stretch(FLOATER_MIN_VISIBLE_PIXELS);
+		mReshapeCallback(mLocationId, r);
+	}
+}
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 743951a41f233bb80cc1e227da39ce5bd68033ec..9e17eaed8bce7a8632c4b0085f8d046abdf89994 100755
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -125,6 +125,19 @@ namespace LLToolBarEnums
 		SIDE_TOP,
 	};
 
+	enum EToolBarLocation
+	{
+		TOOLBAR_NONE = 0,
+		TOOLBAR_LEFT,
+		TOOLBAR_RIGHT,
+		TOOLBAR_BOTTOM,
+
+		TOOLBAR_COUNT,
+
+		TOOLBAR_FIRST = TOOLBAR_LEFT,
+		TOOLBAR_LAST = TOOLBAR_BOTTOM,
+	};
+
 	LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
 }
 
@@ -150,6 +163,30 @@ class LLToolBar
 {
 	friend class LLToolBarButton;
 public:
+
+	class LLCenterLayoutPanel : public LLLayoutPanel
+	{
+	public:
+		typedef struct LLLayoutPanel::Params Params;
+		typedef boost::function<void(LLToolBarEnums::EToolBarLocation tb, const LLRect& rect)> reshape_callback_t;
+
+		virtual ~LLCenterLayoutPanel() {}
+		/*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
+
+		void setLocationId(LLToolBarEnums::EToolBarLocation id) { mLocationId = id; }
+		void setReshapeCallback(reshape_callback_t cb) { mReshapeCallback = cb; }
+		void setButtonPanel(LLPanel * panel) { mButtonPanel = panel; }
+
+	protected:
+		friend class LLUICtrlFactory;
+		LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params), mButtonPanel(NULL) {}
+
+	private:
+		reshape_callback_t					mReshapeCallback;
+		LLToolBarEnums::EToolBarLocation	mLocationId;
+		LLPanel *							mButtonPanel;
+	};
+
 	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
 	{
 		Mandatory<LLToolBarEnums::ButtonType>	button_display_mode;
@@ -198,6 +235,7 @@ class LLToolBar
 	void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
 	void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback     = cb; }
 	bool isReadOnly() const { return mReadOnly; }
+	LLCenterLayoutPanel * getCenterLayoutPanel() const { return mCenterPanel; } 
 
 	LLToolBarButton* createButton(const LLCommandId& id);
 
@@ -270,6 +308,7 @@ class LLToolBar
 
 	// related widgets
 	LLLayoutStack*					mCenteringStack;
+	LLCenterLayoutPanel*			mCenterPanel;
 	LLPanel*						mButtonPanel;
 	LLHandle<class LLContextMenu>	mPopupMenuHandle;
 	LLHandle<class LLView>			mRemoveButtonHandle;
diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp
index 23e574cb74f26ddf86e9eb12581b2f2ef453b34f..12537d9dd18a7ce67685bdd388b2c67f1acec374 100755
--- a/indra/llui/llurlaction.cpp
+++ b/indra/llui/llurlaction.cpp
@@ -87,14 +87,14 @@ void LLUrlAction::executeSLURL(std::string url)
 {
 	if (sExecuteSLURLCallback)
 	{
-		sExecuteSLURLCallback(url);
+		sExecuteSLURLCallback(url ,true);
 	}
 }
 
-void LLUrlAction::clickAction(std::string url)
+void LLUrlAction::clickAction(std::string url, bool trusted_content)
 {
 	// Try to handle as SLURL first, then http Url
-	if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url) )
+	if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url, trusted_content) )
 	{
 		if (sOpenURLCallback)
 		{
diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h
index e731376b95e03d6419ed3f1a29e14344ac15d486..5f3626490cabfe6d58e586752ac2c9493f832c69 100755
--- a/indra/llui/llurlaction.h
+++ b/indra/llui/llurlaction.h
@@ -66,7 +66,7 @@ class LLUrlAction
 	static void showLocationOnMap(std::string url);
 
 	/// perform the appropriate action for left-clicking on a Url
-	static void clickAction(std::string url);
+	static void clickAction(std::string url, bool trusted_content);
 
 	/// copy the label for a Url to the clipboard
 	static void copyLabelToClipboard(std::string url);
@@ -86,7 +86,7 @@ class LLUrlAction
 
 	/// specify the callbacks to enable this class's functionality
 	typedef boost::function<void (const std::string&)> url_callback_t;
-	typedef boost::function<bool(const std::string& url)> execute_url_callback_t;
+	typedef boost::function<bool(const std::string& url, bool trusted_content)> execute_url_callback_t;
 
 	static void	setOpenURLCallback(url_callback_t cb);
 	static void	setOpenURLInternalCallback(url_callback_t cb);
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index b1cc502c4bbf881222d58aed55080d55c0b1ff5f..840f67968d2a68178dd71bfd93b5eaf08a30ff31 100755
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -1067,7 +1067,8 @@ LLUrlEntrySLLabel::LLUrlEntrySLLabel()
 
 std::string LLUrlEntrySLLabel::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
 {
-	return getLabelFromWikiLink(url);
+	std::string label = getLabelFromWikiLink(url);
+	return (!LLUrlRegistry::instance().hasUrl(label)) ? label : getUrl(url);
 }
 
 std::string LLUrlEntrySLLabel::getUrl(const std::string &string) const
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 20015dca1af7295982a27d0f474b94f46a7698bc..5ee2169b664718444144b6daa1092ea08e31e7f9 100755
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -645,14 +645,18 @@ void LLView::setVisible(BOOL visible)
 void LLView::handleVisibilityChange ( BOOL new_visibility )
 {
 	BOOL old_visibility;
+	BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus();
 	BOOST_FOREACH(LLView* viewp, mChildList)
 	{
 		// only views that are themselves visible will have their overall visibility affected by their ancestors
 		old_visibility=viewp->getVisible();
 
-		if (old_visibility!=new_visibility)
+		if(log_visibility_change)
 		{
-			LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget");
+			if (old_visibility!=new_visibility)
+			{
+				LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget");
+			}
 		}
 
 		if (old_visibility)
@@ -660,11 +664,13 @@ void LLView::handleVisibilityChange ( BOOL new_visibility )
 			viewp->handleVisibilityChange ( new_visibility );
 		}
 
-		// Consider changing returns to confirm success and know which widget grabbed it
-		// For now assume success and log at highest xui possible 
-		// NOTE we log actual state - which may differ if it somehow failed to set visibility
-		lldebugs << "LLView::handleVisibilityChange	 - now: " << getVisible()  << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << llendl;
-		
+		if(log_visibility_change)
+		{
+			// Consider changing returns to confirm success and know which widget grabbed it
+			// For now assume success and log at highest xui possible
+			// NOTE we log actual state - which may differ if it somehow failed to set visibility
+			lldebugs << "LLView::handleVisibilityChange	 - now: " << getVisible()  << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << llendl;
+		}
 	}
 }
 
@@ -1308,52 +1314,55 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
 		// move child views according to reshape flags
 		BOOST_FOREACH(LLView* viewp, mChildList)
 		{
-			LLRect child_rect( viewp->mRect );
-
-			if (viewp->followsRight() && viewp->followsLeft())
-			{
-				child_rect.mRight += delta_width;
-			}
-			else if (viewp->followsRight())
-			{
-				child_rect.mLeft += delta_width;
-				child_rect.mRight += delta_width;
-			}
-			else if (viewp->followsLeft())
-			{
-				// left is 0, don't need to adjust coords
-			}
-			else
+			if (viewp != NULL)
 			{
-				// BUG what to do when we don't follow anyone?
-				// for now, same as followsLeft
-			}
+				LLRect child_rect( viewp->mRect );
 
-			if (viewp->followsTop() && viewp->followsBottom())
-			{
-				child_rect.mTop += delta_height;
-			}
-			else if (viewp->followsTop())
-			{
-				child_rect.mTop += delta_height;
-				child_rect.mBottom += delta_height;
-			}
-			else if (viewp->followsBottom())
-			{
-				// bottom is 0, so don't need to adjust coords
-			}
-			else
-			{
-				// BUG what to do when we don't follow?
-				// for now, same as bottom
-			}
+				if (viewp->followsRight() && viewp->followsLeft())
+				{
+					child_rect.mRight += delta_width;
+				}
+				else if (viewp->followsRight())
+				{
+					child_rect.mLeft += delta_width;
+					child_rect.mRight += delta_width;
+				}
+				else if (viewp->followsLeft())
+				{
+					// left is 0, don't need to adjust coords
+				}
+				else
+				{
+					// BUG what to do when we don't follow anyone?
+					// for now, same as followsLeft
+				}
 
-			S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
-			S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
-			viewp->translate( delta_x, delta_y );
-			if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight())
-			{
-				viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
+				if (viewp->followsTop() && viewp->followsBottom())
+				{
+					child_rect.mTop += delta_height;
+				}
+				else if (viewp->followsTop())
+				{
+					child_rect.mTop += delta_height;
+					child_rect.mBottom += delta_height;
+				}
+				else if (viewp->followsBottom())
+				{
+					// bottom is 0, so don't need to adjust coords
+				}
+				else
+				{
+					// BUG what to do when we don't follow?
+					// for now, same as bottom
+				}
+
+				S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
+				S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
+				viewp->translate( delta_x, delta_y );
+				if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight())
+				{
+					viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
+				}
 			}
 		}
 	}
diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp
index a352f621eb5aab413752a228db731e5ae4e560c1..546a0f58667fbee559d52904d36b3b49da296fc9 100644
--- a/indra/llui/llviewereventrecorder.cpp
+++ b/indra/llui/llviewereventrecorder.cpp
@@ -31,7 +31,7 @@
 LLViewerEventRecorder::LLViewerEventRecorder() {
 
   clear(UNDEFINED);
-
+  logEvents = false;
   // Remove any previous event log file
   std::string old_log_ui_events_to_llsd_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife_Events_log.old");
   LLFile::remove(old_log_ui_events_to_llsd_file);
diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h
index 72ca643ced027e09501844a374288c3c0d828565..375efcc3de870ab83ca2c8590fa651dafdebc18d 100644
--- a/indra/llui/llviewereventrecorder.h
+++ b/indra/llui/llviewereventrecorder.h
@@ -65,7 +65,7 @@ class LLViewerEventRecorder : public LLSingleton<LLViewerEventRecorder>
   std::string get_xui();
   void update_xui(std::string xui);
 
-  bool getLoggingStatus();
+  bool getLoggingStatus(){return logEvents;};
   void setEventLoggingOn();
   void setEventLoggingOff();
 
diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp
index 460d2a8b4fb70757cea4ce18e2b23ecb35b855d0..229608231ca5ccfc88a17d2ba85b7f3f7d062ce8 100755
--- a/indra/llvfs/lldiriterator.cpp
+++ b/indra/llvfs/lldiriterator.cpp
@@ -119,16 +119,25 @@ bool LLDirIterator::Impl::next(std::string &fname)
 
 	fs::directory_iterator end_itr; // default construction yields past-the-end
 	bool found = false;
-	while (mIter != end_itr && !found)
+
+	// Check if path is a directory.
+	try
 	{
-		boost::smatch match;
-		std::string name = mIter->path().filename().string();
-		if (found = boost::regex_match(name, match, mFilterExp))
+		while (mIter != end_itr && !found)
 		{
-			fname = name;
+			boost::smatch match;
+			std::string name = mIter->path().filename().string();
+			if (found = boost::regex_match(name, match, mFilterExp))
+			{
+				fname = name;
+			}
+
+			++mIter;
 		}
-
-		++mIter;
+	}
+	catch (const fs::filesystem_error& e)
+	{
+		llwarns << e.what() << llendl;
 	}
 
 	return found;
diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp
index 82c926620a07960695337df7148752bdb9aa5f0a..7b589f5b9672fbcb866d59b17284b53d8c363d9c 100755
--- a/indra/llvfs/llvfs.cpp
+++ b/indra/llvfs/llvfs.cpp
@@ -578,6 +578,7 @@ LLVFS::~LLVFS()
 	mFreeBlocksByLength.clear();
 
 	for_each(mFreeBlocksByLocation.begin(), mFreeBlocksByLocation.end(), DeletePairedPointer());
+	mFreeBlocksByLocation.clear();
     
 	unlockAndClose(mDataFP);
 	mDataFP = NULL;
@@ -1835,6 +1836,7 @@ void LLVFS::audit()
 	}
 
 	for_each(audit_blocks.begin(), audit_blocks.end(), DeletePointer());
+	audit_blocks.clear();
 }
     
     
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index 3579b5d42f0d09dcd1ad12c58ce89dd55677c527..b0f4bc55035dfa835c798b5000eaf6439f428ece 100755
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -171,6 +171,7 @@ std::string LLDXDriverFile::dump()
 LLDXDevice::~LLDXDevice()
 {
 	for_each(mDriverFiles.begin(), mDriverFiles.end(), DeletePairedPointer());
+	mDriverFiles.clear();
 }
 
 std::string LLDXDevice::dump()
@@ -230,6 +231,7 @@ LLDXHardware::LLDXHardware()
 void LLDXHardware::cleanup()
 {
   // for_each(mDevices.begin(), mDevices.end(), DeletePairedPointer());
+  // mDevices.clear();
 }
 
 /*
diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp
index aac349bf57d526e3d6ef979a13d82d36385d3b36..49a1c9dba3062f1f4685195e03f6190b76958cfc 100755
--- a/indra/media_plugins/winmmshim/winmm_shim.cpp
+++ b/indra/media_plugins/winmmshim/winmm_shim.cpp
@@ -4,7 +4,7 @@
  *
  * $LicenseInfo:firstyear=2010&license=viewerlgpl$
  * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2010-2014, Linden Research, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,8 +30,8 @@
 
 using std::wstring;
 
-static float sVolumeLevel = 1.f;
-static bool sMute = false;
+static float sVolumeLevel = 1.f;		// Could be covered by critical section,
+static bool sMute = false;				// not needed with atomicity and alignment.
 static CRITICAL_SECTION sCriticalSection;
 
 BOOL APIENTRY DllMain( HMODULE hModule,
@@ -39,37 +39,44 @@ BOOL APIENTRY DllMain( HMODULE hModule,
                        LPVOID lpReserved
 					 )
 {
-	InitializeCriticalSection(&sCriticalSection);
+	if (DLL_PROCESS_ATTACH == ul_reason_for_call)
+	{
+		InitializeCriticalSection(&sCriticalSection);
+	}
 	return TRUE;
 }
 
 void ll_winmm_shim_initialize(){
-	static bool initialized = false;
-	// do this only once
-	EnterCriticalSection(&sCriticalSection);
+	static volatile bool initialized = false;
+
+	// do this only once using double-check locking
 	if (!initialized)
-	{	// bind to original winmm.dll
-		TCHAR system_path[MAX_PATH];
-		TCHAR dll_path[MAX_PATH];
-		::GetSystemDirectory(system_path, MAX_PATH);
-
-		// grab winmm.dll from system path, where it should live
-		wsprintf(dll_path, "%s\\winmm.dll", system_path);
-		HMODULE winmm_handle = ::LoadLibrary(dll_path);
-
-		if (winmm_handle != NULL)
-		{	// we have a dll, let's get out pointers!
-			initialized = true;
-			init_function_pointers(winmm_handle);
-			::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n");
-		}
-		else
-		{
-			// failed to initialize real winmm.dll
-			::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n");
+	{
+		EnterCriticalSection(&sCriticalSection);
+		if (!initialized)
+		{	// bind to original winmm.dll
+			TCHAR system_path[MAX_PATH];
+			TCHAR dll_path[MAX_PATH];
+			::GetSystemDirectory(system_path, MAX_PATH);
+
+			// grab winmm.dll from system path, where it should live
+			wsprintf(dll_path, "%s\\winmm.dll", system_path);
+			HMODULE winmm_handle = ::LoadLibrary(dll_path);
+
+			if (winmm_handle != NULL)
+			{	// we have a dll, let's get out pointers!
+				init_function_pointers(winmm_handle);
+				::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n");
+				initialized = true;		// Last thing after completing setup
+			}
+			else
+			{
+				// failed to initialize real winmm.dll
+				::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n");
+			}
 		}
+		LeaveCriticalSection(&sCriticalSection);
 	}
-	LeaveCriticalSection(&sCriticalSection);
 }
 
 
@@ -84,7 +91,7 @@ extern "C"
 		int	mBitsPerSample;
 	};
 	typedef std::map<HWAVEOUT, WaveOutFormat*> wave_out_map_t;
-	static wave_out_map_t sWaveOuts;
+	static wave_out_map_t sWaveOuts;						// Covered by sCriticalSection
 
 	MMRESULT WINAPI waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
 	{
@@ -100,7 +107,9 @@ extern "C"
 			&& ((fdwOpen & WAVE_FORMAT_QUERY) == 0)) // not just querying for format support
 		{	// remember the requested bits per sample, and associate with the given handle
 			WaveOutFormat* wave_outp = new WaveOutFormat(pwfx->wBitsPerSample);
+			EnterCriticalSection(&sCriticalSection);
 			sWaveOuts.insert(std::make_pair(*phwo, wave_outp));
+			LeaveCriticalSection(&sCriticalSection);
 		}
 		return result;
 	}
@@ -108,13 +117,15 @@ extern "C"
 	MMRESULT WINAPI waveOutClose( HWAVEOUT hwo)
 	{
 		ll_winmm_shim_initialize();
+		EnterCriticalSection(&sCriticalSection);
 		wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
 		if (found_it != sWaveOuts.end())
 		{	// forget what we know about this handle
 			delete found_it->second;
 			sWaveOuts.erase(found_it);
 		}
-		return waveOutClose_orig( hwo);
+		LeaveCriticalSection(&sCriticalSection);
+		return waveOutClose_orig(hwo);
 	}
 
 	MMRESULT WINAPI waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh)
@@ -128,11 +139,19 @@ extern "C"
 		}
 		else if (sVolumeLevel != 1.f) 
 		{ // need to apply volume level
+			int bits_per_sample(0);
+			
+			EnterCriticalSection(&sCriticalSection);
 			wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
 			if (found_it != sWaveOuts.end())
 			{
-				WaveOutFormat* formatp = found_it->second;
-				switch (formatp->mBitsPerSample){
+				bits_per_sample = found_it->second->mBitsPerSample;
+			}
+			LeaveCriticalSection(&sCriticalSection);
+			if (bits_per_sample)
+			{
+				switch (bits_per_sample)
+				{
 				case 8:
 					{
 						char volume = (char)(sVolumeLevel * 127.f);
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index c1e43e6d45b265239c6a1cbfd3ffcc13f46d4b14..aaf18d29482f17f2ad2793f0104a27740b190352 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-3.7.3
+3.7.5
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 4c7b192ae5f531e5c950353e55ac432d7cfe65dd..d39bf6c3c21573068033e3e2d508fcf1bf3d0d5c 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1203,7 +1203,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>BulkChangeShareWithGroup</key>
     <map>
@@ -3569,13 +3569,13 @@
     <key>FPSLogFrequency</key>
         <map>
         <key>Comment</key>
-            <string>Seconds between display of FPS in log (0 for never)</string>
+        <string>Seconds between display of FPS in log (0 for never)</string>
         <key>Persist</key>
-            <integer>1</integer>
+        <integer>1</integer>
         <key>Type</key>
-            <string>F32</string>
+        <string>F32</string>
         <key>Value</key>
-            <real>10.0</real>
+        <real>10.0</real>
         </map>
     <key>FilterItemsMaxTimePerFrameVisible</key>
     <map>
@@ -8696,7 +8696,7 @@
   <key>RenderDepthOfField</key>
   <map>
     <key>Comment</key>
-    <string>Whether to use depth of field effect when lighting and shadows are enabled</string>
+    <string>Whether to use depth of field effect when Advanced Lighting Model is enabled</string>
     <key>Persist</key>
     <integer>1</integer>
     <key>Type</key>
@@ -9991,7 +9991,18 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>RevokePermsOnStopAnimation</key>
+		<key>ReportBugURL</key>
+		<map>
+			<key>Comment</key>
+			<string>URL used for filing bugs from viewer</string>
+			<key>Persist</key>
+			<integer>1</integer>
+			<key>Type</key>
+			<string>String</string>
+			<key>Value</key>
+			<string>https://jira.secondlife.com/secure/CreateIssueDetails!init.jspa?pid=10610&amp;issuetype=1&amp;environment=[ENVIRONMENT]&amp;customfield_10253=[LOCATION]</string>
+		</map>
+	<key>RevokePermsOnStopAnimation</key>
     <map>
       <key>Comment</key>
       <string>Clear animation permssions when choosing "Stop Animating Me"</string>
diff --git a/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl b/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..1936e0dcaa6de6fc90d351fc75eb06419b0ed426
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/benchmarkF.glsl
@@ -0,0 +1,39 @@
+/** 
+ * @file benchmarkF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2D diffuseMap;
+
+VARYING vec2 tc0;
+
+void main() 
+{
+	frag_color = texture2D(diffuseMap, tc0);
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl b/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..7beb20ede462e547a7d1d649a57d91bdc0603907
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/benchmarkV.glsl
@@ -0,0 +1,38 @@
+/** 
+ * @file benchmarkV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+
+VARYING vec2 tc0;
+
+void main()
+{
+	gl_Position = vec4(position, 1.0); 
+	
+	tc0 = (position.xy*0.5+0.5);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
index 67dc5004933fdee792c3bfcc3ffbaafbc7593ec8..da02534dbb59421d80d1e2bbba06a25107923940 100755
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
@@ -31,12 +31,13 @@ out vec4 frag_color;
 
 uniform sampler2D tex0;
 
-VARYING vec4 vertex_color;
+uniform vec4 color;
+
 VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	float alpha = texture2D(tex0, vary_texcoord0.xy).a * vertex_color.a;
+	float alpha = texture2D(tex0, vary_texcoord0.xy).a * color.a;
 
-	frag_color = vec4(vertex_color.rgb, alpha);
+	frag_color = vec4(color.rgb, alpha);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
index c58f9dfdaf84554d27e407035229ae23df175b88..f33115d78d7004aa8726eceff29d2b4673024c88 100755
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -26,16 +26,13 @@
 uniform mat4 modelview_projection_matrix;
  
 ATTRIBUTE vec3 position;
-ATTRIBUTE vec4 diffuse_color;
 ATTRIBUTE vec2 texcoord0;
 
-VARYING vec4 vertex_color;
 VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	vertex_color = diffuse_color;
 	vary_texcoord0 = texcoord0;
 }
 
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 0bdd42550474aefa3d931362b65efbea7276ceb3..a2d68eb550bd1b6a6059df9cccd4fd04417f46dc 100755
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 35
+version 36
 // The version number above should be implemented IF AND ONLY IF some
 // change has been made that is sufficiently important to justify
 // resetting the graphics preferences of all users to the recommended
@@ -628,3 +628,6 @@ Disregard128DefaultDrawDistance	1	0
 list NVIDIA_GeForce_Go_7400
 Disregard128DefaultDrawDistance	1	0
 
+list OSX_10_6_8
+RenderDeferred 0 0
+
diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm
index 91251ed7c03626d190675c23f7a9adfb60ddff76..988058aad34752ac5e32d52ca87fb45c7d6bfc12 100644
--- a/indra/newview/llappdelegate-objc.mm
+++ b/indra/newview/llappdelegate-objc.mm
@@ -40,6 +40,11 @@
     [super dealloc];
 }
 
+- (void) applicationWillFinishLaunching:(NSNotification *)notification
+{
+    [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
+}
+
 - (void) applicationDidFinishLaunching:(NSNotification *)notification
 {
 	frameTimer = nil;
@@ -55,7 +60,7 @@
 	
 	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(languageUpdated) name:@"NSTextInputContextKeyboardSelectionDidChangeNotification" object:nil];
 
-    [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
+ //   [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
 }
 
 - (void) handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 539d186441030cd76bae280490ac785472205988..e3c89f1a5f4b7144411fb06d4b7890fe41688f75 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -40,6 +40,7 @@
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llagentlanguage.h"
+#include "llagentui.h"
 #include "llagentwearables.h"
 #include "llfloaterimcontainer.h"
 #include "llwindow.h"
@@ -60,6 +61,7 @@
 #include "llcurl.h"
 #include "llcalc.h"
 #include "llconversationlog.h"
+#include "lldxhardware.h"
 #include "lltexturestats.h"
 #include "lltexturestats.h"
 #include "llviewerwindow.h"
@@ -75,10 +77,10 @@
 #include "lluicolortable.h"
 #include "llurldispatcher.h"
 #include "llurlhistory.h"
-//#include "llfirstuse.h"
 #include "llrender.h"
 #include "llteleporthistory.h"
 #include "lltoast.h"
+#include "llsdutil_math.h"
 #include "lllocationhistory.h"
 #include "llfasttimerview.h"
 #include "llvector4a.h"
@@ -755,7 +757,7 @@ bool LLAppViewer::init()
 	initLoggingAndGetLastDuration();
 	
 	processMarkerFiles();
-
+	
 	//
 	// OK to write stuff to logs now, we've now crash reported if necessary
 	//
@@ -1230,8 +1232,8 @@ void LLAppViewer::checkMemory()
 	}
 	mMemCheckTimer.reset() ;
 
-		//update the availability of memory
-		LLMemory::updateMemoryInfo() ;
+	//update the availability of memory
+	LLMemory::updateMemoryInfo() ;
 
 	bool is_low = LLMemory::isMemoryPoolLow() ;
 
@@ -1761,7 +1763,7 @@ bool LLAppViewer::cleanup()
 		gAudiop->setStreamingAudioImpl(NULL);
 
 		// shut down the audio subsystem
-			gAudiop->shutdown();
+        gAudiop->shutdown();
 
 		delete gAudiop;
 		gAudiop = NULL;
@@ -2574,9 +2576,9 @@ bool LLAppViewer::initConfiguration()
                 {
 					llwarns << "Failed --set " << name << ": setting name unknown." << llendl;
                 }
+                }
             }
         }
-    }
 
     if  (clp.hasOption("logevents")) {
 	LLViewerEventRecorder::instance().setEventLoggingOn();
@@ -2584,7 +2586,7 @@ bool LLAppViewer::initConfiguration()
 
 	std::string CmdLineChannel(gSavedSettings.getString("CmdLineChannel"));
 	if(! CmdLineChannel.empty())
-    {
+	{
 		LLVersionInfo::resetChannel(CmdLineChannel);
 	}
 
@@ -2596,16 +2598,16 @@ bool LLAppViewer::initConfiguration()
 		LLFastTimer::sLog = TRUE;
 		LLFastTimer::sLogName = std::string("performance");		
 	}
-	
+
 	std::string test_name(gSavedSettings.getString("LogMetrics"));
 	if (! test_name.empty())
- 	{
+	{
  		LLFastTimer::sMetricLog = TRUE ;
 		// '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test
 		// In the absence of argument, every metric would be gathered (makes for a rather slow run and hard to decipher report...)
 		llinfos << "'--logmetrics' argument : " << test_name << llendl;
 			LLFastTimer::sLogName = test_name;
-		}
+ 	}
 
 	if (clp.hasOption("graphicslevel"))
 	{
@@ -2614,14 +2616,14 @@ bool LLAppViewer::initConfiguration()
 		// that value for validity.
 		U32 graphicslevel = gSavedSettings.getU32("RenderQualityPerformance");
 		if (LLFeatureManager::instance().isValidGraphicsLevel(graphicslevel))
-        {
+		{
 			// graphicslevel is valid: save it and engage it later. Capture
 			// the requested value separately from the settings variable
 			// because, if this is the first run, LLViewerWindow's constructor
 			// will call LLFeatureManager::applyRecommendedSettings(), which
 			// overwrites this settings variable!
 			mForceGraphicsLevel = graphicslevel;
-        }
+		}
 	}
 
 	LLFastTimerView::sAnalyzePerformance = gSavedSettings.getBOOL("AnalyzePerformance");
@@ -2655,14 +2657,14 @@ bool LLAppViewer::initConfiguration()
 	LLSLURL start_slurl;
 	std::string CmdLineLoginLocation(gSavedSettings.getString("CmdLineLoginLocation"));
 	if(! CmdLineLoginLocation.empty())
-    {
+	{
 		start_slurl = CmdLineLoginLocation;
 		LLStartUp::setStartSLURL(start_slurl);
 		if(start_slurl.getType() == LLSLURL::LOCATION) 
-		{  
+	{
 			LLGridManager::getInstance()->setGridChoice(start_slurl.getGrid());
-    }
-    }
+		}
+	}
 
 	//RN: if we received a URL, hand it off to the existing instance.
 	// don't call anotherInstanceRunning() when doing URL handoff, as
@@ -2673,11 +2675,11 @@ bool LLAppViewer::initConfiguration()
 		(gSavedSettings.getBOOL("SLURLPassToOtherInstance")))
 	{
 		if (sendURLToOtherInstance(start_slurl.getSLURLString()))
-		{
+		{  
 			// successfully handed off URL to existing instance, exit
 			return false;
 		}
-    }
+	}
 
 	const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
 	if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString())
@@ -2994,26 +2996,26 @@ namespace {
 		{
 			LL_WARNS("UpdaterService") << "no info url supplied - defaulting to hard coded release notes pattern" << LL_ENDL;
 
-		// truncate version at the rightmost '.' 
-		std::string version_short(data["version"]);
-		size_t short_length = version_short.rfind('.');
-		if (short_length != std::string::npos)
-		{
-			version_short.resize(short_length);
-		}
+			// truncate version at the rightmost '.' 
+			std::string version_short(data["version"]);
+			size_t short_length = version_short.rfind('.');
+			if (short_length != std::string::npos)
+			{
+				version_short.resize(short_length);
+			}
 
-		LLUIString relnotes_url("[RELEASE_NOTES_BASE_URL][CHANNEL_URL]/[VERSION_SHORT]");
-		relnotes_url.setArg("[VERSION_SHORT]", version_short);
+			LLUIString relnotes_url("[RELEASE_NOTES_BASE_URL][CHANNEL_URL]/[VERSION_SHORT]");
+			relnotes_url.setArg("[VERSION_SHORT]", version_short);
 
-		// *TODO thread the update service's response through to this point
-		std::string const & channel = LLVersionInfo::getChannel();
-		boost::shared_ptr<char> channel_escaped(curl_escape(channel.c_str(), channel.size()), &curl_free);
+			// *TODO thread the update service's response through to this point
+			std::string const & channel = LLVersionInfo::getChannel();
+			boost::shared_ptr<char> channel_escaped(curl_escape(channel.c_str(), channel.size()), &curl_free);
 
-		relnotes_url.setArg("[CHANNEL_URL]", channel_escaped.get());
-		relnotes_url.setArg("[RELEASE_NOTES_BASE_URL]", LLTrans::getString("RELEASE_NOTES_BASE_URL"));
+			relnotes_url.setArg("[CHANNEL_URL]", channel_escaped.get());
+			relnotes_url.setArg("[RELEASE_NOTES_BASE_URL]", LLTrans::getString("RELEASE_NOTES_BASE_URL"));
 			substitutions["INFO_URL"] = relnotes_url.getString();
 		}
-
+		
 		LLNotificationsUtil::add(notification_name, substitutions, LLSD(), apply_callback);
 	}
 
@@ -3202,7 +3204,7 @@ bool LLAppViewer::initWindow()
 		LLFeatureManager::getInstance()->setGraphicsLevel(*mForceGraphicsLevel, false);
 		gSavedSettings.setU32("RenderQualityPerformance", *mForceGraphicsLevel);
 	}
-			
+
 	// Set this flag in case we crash while initializing GL
 	gSavedSettings.setBOOL("RenderInitError", TRUE);
 	gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
@@ -3261,6 +3263,183 @@ void LLAppViewer::writeDebugInfo()
 	out_file.close();
 }
 
+LLSD LLAppViewer::getViewerInfo() const
+{
+	// The point of having one method build an LLSD info block and the other
+	// construct the user-visible About string is to ensure that the same info
+	// is available to a getInfo() caller as to the user opening
+	// LLFloaterAbout.
+	LLSD info;
+	LLSD version;
+	version.append(LLVersionInfo::getMajor());
+	version.append(LLVersionInfo::getMinor());
+	version.append(LLVersionInfo::getPatch());
+	version.append(LLVersionInfo::getBuild());
+	info["VIEWER_VERSION"] = version;
+	info["VIEWER_VERSION_STR"] = LLVersionInfo::getVersion();
+	info["BUILD_DATE"] = __DATE__;
+	info["BUILD_TIME"] = __TIME__;
+	info["CHANNEL"] = LLVersionInfo::getChannel();
+
+	// return a URL to the release notes for this viewer, such as:
+	// http://wiki.secondlife.com/wiki/Release_Notes/Second Life Beta Viewer/2.1.0.123456
+	std::string url = LLTrans::getString("RELEASE_NOTES_BASE_URL");
+	if (! LLStringUtil::endsWith(url, "/"))
+		url += "/";
+	url += LLURI::escape(LLVersionInfo::getChannel()) + "/";
+	url += LLURI::escape(LLVersionInfo::getVersion());
+
+	info["VIEWER_RELEASE_NOTES_URL"] = url;
+
+#if LL_MSVC
+	info["COMPILER"] = "MSVC";
+	info["COMPILER_VERSION"] = _MSC_VER;
+#elif LL_GNUC
+	info["COMPILER"] = "GCC";
+	info["COMPILER_VERSION"] = GCC_VERSION;
+#endif
+
+	// Position
+	LLViewerRegion* region = gAgent.getRegion();
+	if (region)
+	{
+		LLVector3d pos = gAgent.getPositionGlobal();
+		info["POSITION"] = ll_sd_from_vector3d(pos);
+		info["POSITION_LOCAL"] = ll_sd_from_vector3(gAgent.getPosAgentFromGlobal(pos));
+		info["REGION"] = gAgent.getRegion()->getName();
+		info["HOSTNAME"] = gAgent.getRegion()->getHost().getHostName();
+		info["HOSTIP"] = gAgent.getRegion()->getHost().getString();
+		info["SERVER_VERSION"] = gLastVersionChannel;
+		LLSLURL slurl;
+		LLAgentUI::buildSLURL(slurl);
+		info["SLURL"] = slurl.getSLURLString();
+	}
+
+	// CPU
+	info["CPU"] = gSysCPU.getCPUString();
+	info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB() / 1024);
+	// Moved hack adjustment to Windows memory size into llsys.cpp
+	info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString();
+	info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR));
+	info["GRAPHICS_CARD"] = (const char*)(glGetString(GL_RENDERER));
+
+#if LL_WINDOWS
+	LLSD driver_info = gDXHardware.getDisplayInfo();
+	if (driver_info.has("DriverVersion"))
+	{
+		info["GRAPHICS_DRIVER_VERSION"] = driver_info["DriverVersion"];
+	}
+#endif
+
+	info["OPENGL_VERSION"] = (const char*)(glGetString(GL_VERSION));
+	info["LIBCURL_VERSION"] = LLCurl::getVersionString();
+	info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
+	bool want_fullname = true;
+	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
+	if(LLVoiceClient::getInstance()->voiceEnabled())
+	{
+		LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
+		std::ostringstream version_string;
+		version_string << version.serverType << " " << version.serverVersion << std::endl;
+		info["VOICE_VERSION"] = version_string.str();
+	}
+	else 
+	{
+		info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
+	}
+
+	// TODO: Implement media plugin version query
+	info["QT_WEBKIT_VERSION"] = "4.7.1 (version number hard-coded)";
+
+	if (gPacketsIn > 0)
+	{
+		info["PACKETS_LOST"] = LLViewerStats::getInstance()->mPacketsLostStat.getCurrent();
+		info["PACKETS_IN"] = F32(gPacketsIn);  
+		info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal();
+	}
+
+	if (mServerReleaseNotesURL.empty())
+	{
+		if (gAgent.getRegion())
+		{
+			info["SERVER_RELEASE_NOTES_URL"] = LLTrans::getString("RetrievingData");
+		}
+	}
+	else if (LLStringUtil::startsWith(mServerReleaseNotesURL, "http")) // it's an URL
+	{
+		info["SERVER_RELEASE_NOTES_URL"] = "[" + LLWeb::escapeURL(mServerReleaseNotesURL) + " " + LLTrans::getString("ReleaseNotes") + "]";
+	}
+	else
+	{
+		info["SERVER_RELEASE_NOTES_URL"] = mServerReleaseNotesURL;
+	}
+
+	return info;
+}
+
+std::string LLAppViewer::getViewerInfoString() const
+{
+	std::ostringstream support;
+
+	LLSD info(getViewerInfo());
+
+	// Render the LLSD from getInfo() as a format_map_t
+	LLStringUtil::format_map_t args;
+
+	// allow the "Release Notes" URL label to be localized
+	args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes");
+
+	for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
+		ii != iend; ++ii)
+	{
+		if (! ii->second.isArray())
+		{
+			// Scalar value
+			if (ii->second.isUndefined())
+			{
+				args[ii->first] = LLTrans::getString("none_text");
+			}
+			else
+			{
+				// don't forget to render value asString()
+				args[ii->first] = ii->second.asString();
+			}
+		}
+		else
+		{
+			// array value: build KEY_0, KEY_1 etc. entries
+			for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n)
+			{
+				args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString();
+			}
+		}
+	}
+
+	// Now build the various pieces
+	support << LLTrans::getString("AboutHeader", args);
+	if (info.has("REGION"))
+	{
+		support << "\n\n" << LLTrans::getString("AboutPosition", args);
+	}
+	support << "\n\n" << LLTrans::getString("AboutSystem", args);
+	support << "\n";
+	if (info.has("GRAPHICS_DRIVER_VERSION"))
+	{
+		support << "\n" << LLTrans::getString("AboutDriver", args);
+	}
+	support << "\n" << LLTrans::getString("AboutLibs", args);
+	if (info.has("COMPILER"))
+	{
+		support << "\n" << LLTrans::getString("AboutCompiler", args);
+	}
+	if (info.has("PACKETS_IN"))
+	{
+		support << '\n' << LLTrans::getString("AboutTraffic", args);
+	}
+	return support.str();
+}
+
+
 void LLAppViewer::cleanupSavedSettings()
 {
 	gSavedSettings.setBOOL("MouseSun", FALSE);
@@ -3485,9 +3664,9 @@ void LLAppViewer::handleViewerCrash()
 	if (gDirUtilp)
 	{
 		std::string crash_marker_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
-																			gLLErrorActivated
-																			? LLERROR_MARKER_FILE_NAME
-																			: ERROR_MARKER_FILE_NAME);
+																	 gLLErrorActivated
+																	 ? LLERROR_MARKER_FILE_NAME
+																	 : ERROR_MARKER_FILE_NAME);
 		LLAPRFile crash_marker_file ;
 		crash_marker_file.open(crash_marker_file_name, LL_APR_WB);
 		if (crash_marker_file.getFileHandle())
@@ -3498,7 +3677,7 @@ void LLAppViewer::handleViewerCrash()
 		else
 		{
 			LL_WARNS("MarkerFile") << "Cannot create error marker file " << crash_marker_file_name << LL_ENDL;
-		}
+		}		
 	}
 	else
 	{
@@ -3637,7 +3816,7 @@ void LLAppViewer::processMarkerFiles()
 		}
 
 		if (mSecondInstance)
-		{
+	{
 			LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' owned by another instance" << LL_ENDL;
 		}
 		else if (marker_is_same_version)
@@ -3651,7 +3830,7 @@ void LLAppViewer::processMarkerFiles()
 		{
 			LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found, but versions did not match" << LL_ENDL;
 		}
-	}
+	}    
 	else // marker did not exist... last exec (if any) did not freeze
 	{
 		// Create the marker file for this execution & lock it; it will be deleted on a clean exit
@@ -3705,12 +3884,12 @@ void LLAppViewer::processMarkerFiles()
 			{
 				gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
 				LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
-			}
-			else
-			{
+		}
+		else
+		{
 				gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
 				LL_INFOS("MarkerFile") << "LLError marker '"<< llerror_marker_file << "' crashed, setting LastExecEvent to LLERROR_CRASH" << LL_ENDL;
-			}
+		}
 		}
 		else
 		{
@@ -3723,20 +3902,20 @@ void LLAppViewer::processMarkerFiles()
 	if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
 	{
 		if (markerIsSameVersion(error_marker_file))
-		{
+	{
 			if (gLastExecEvent == LAST_EXEC_LOGOUT_FROZE)
-			{
+		{
 				gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
 				LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;
-			}
-			else
-			{
-				gLastExecEvent = LAST_EXEC_OTHER_CRASH;
-				LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
-			}
 		}
 		else
 		{
+				gLastExecEvent = LAST_EXEC_OTHER_CRASH;
+				LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
+		}
+	}
+	else
+	{
 			LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' marker found, but versions did not match" << LL_ENDL;
 		}
 		LLAPRFile::remove(error_marker_file);
@@ -3748,29 +3927,29 @@ void LLAppViewer::removeMarkerFile(bool leave_logout_marker)
 	if (!mSecondInstance)
 	{		
 		LL_DEBUGS("MarkerFile") << (leave_logout_marker?"leave":"remove") <<" logout" << LL_ENDL;
-		if (mMarkerFile.getFileHandle())
-		{
+	if (mMarkerFile.getFileHandle())
+	{
 			LL_DEBUGS("MarkerFile") << "removing exec marker '"<<mMarkerFileName<<"'"<< LL_ENDL;
 			mMarkerFile.close() ;
-			LLAPRFile::remove( mMarkerFileName );
-		}
-		else
-		{
+		LLAPRFile::remove( mMarkerFileName );
+	}
+	else
+	{
 			LL_WARNS("MarkerFile") << "marker '"<<mMarkerFileName<<"' not open"<< LL_ENDL;
-		}
-		if (!leave_logout_marker)
+	}
+	if (!leave_logout_marker)
+	{
+		if (mLogoutMarkerFile.getFileHandle())
 		{
-			if (mLogoutMarkerFile.getFileHandle())
-			{
 				LL_DEBUGS("MarkerFile") << "removing logout marker '"<<mLogoutMarkerFileName<<"'"<< LL_ENDL;
-				mLogoutMarkerFile.close();
-			}
-			else
-			{
+			mLogoutMarkerFile.close();
+		}
+		else
+		{
 				LL_WARNS("MarkerFile") << "logout marker '"<<mLogoutMarkerFileName<<"' not open"<< LL_ENDL;
-			}
-			LLAPRFile::remove( mLogoutMarkerFileName );
 		}
+		LLAPRFile::remove( mLogoutMarkerFileName );
+	}
 	}
 	else
 	{
@@ -4713,7 +4892,7 @@ void LLAppViewer::idle()
 		
         if (!(logoutRequestSent() && hasSavedFinalSnapshot()))
 		{
-			gObjectList.update(gAgent, *LLWorld::getInstance());
+			gObjectList.update(gAgent);
 		}
 	}
 	
@@ -5402,7 +5581,7 @@ void LLAppViewer::handleLoginComplete()
 
 void LLAppViewer::launchUpdater()
 {
-		LLSD query_map = LLSD::emptyMap();
+	LLSD query_map = LLSD::emptyMap();
 	query_map["os"] = gPlatform;
 
 	// *TODO change userserver to be grid on both viewer and sim, since
@@ -5599,7 +5778,7 @@ void LLAppViewer::metricsSend(bool enable_reporting)
 			// Make a copy of the main stats to send into another thread.
 			// Receiving thread takes ownership.
 			LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStatsMain));
-			
+
 			// Send a report request into 'thread1' to get the rest of the data
 			// and provide some additional parameters while here.
 			LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 3ae8a78845a1f1835c4e5a481077d0e921b3f19b..05326c2bafe70785c2c2c48e626dc84b717463f4 100755
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -86,6 +86,10 @@ class LLAppViewer : public LLApp
 
 	const LLOSInfo& getOSInfo() const { return mSysOSInfo; }
 
+	void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; }
+	LLSD getViewerInfo() const;
+	std::string getViewerInfoString() const;
+
 	// Report true if under the control of a debugger. A null-op default.
 	virtual bool beingDebugged() { return false; } 
 
@@ -246,6 +250,8 @@ class LLAppViewer : public LLApp
 	LLOSInfo mSysOSInfo; 
 	bool mReportedCrash;
 
+	std::string mServerReleaseNotesURL;
+
 	// Thread objects.
 	static LLTextureCache* sTextureCache; 
 	static LLImageDecodeThread* sImageDecodeThread; 
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 80a80f42989bc155bbd758064a66005a5dafb346..2764025d75d82c99a4799ff0e8272c26fe451a07 100755
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -200,14 +200,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
                      LPSTR     lpCmdLine,
                      int       nCmdShow)
 {
-#ifdef INCLUDE_VLD
-	// only works for debug builds (hard coded into vld.h)
-	#ifdef _DEBUG
-		// start with Visual Leak Detector turned off
-		VLDGlobalDisable();
-	#endif // _DEBUG
-#endif // INCLUDE_VLD
-
 	const S32 MAX_HEAPS = 255;
 	DWORD heap_enable_lfh_error[MAX_HEAPS];
 	S32 num_heaps = 0;
diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp
index 77d734cbfe3ee73f2ef099881b26abf69a8ace8b..d6a72b0c05d72bb6f78e3d7483db502dd3495e53 100644
--- a/indra/newview/llavatarrenderinfoaccountant.cpp
+++ b/indra/newview/llavatarrenderinfoaccountant.cpp
@@ -256,7 +256,7 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio
 					{
 						llinfos << "LRI: Sending avatar render info for " << avatar->getID()
 							<< ": " << info << llendl;
-						llinfos << "LRI: geometry " << avatar->getAttachmentGeometryBytes()
+						llinfos << "LRI: other info geometry " << avatar->getAttachmentGeometryBytes()
 							<< ", area " << avatar->getAttachmentSurfaceArea()
 							<< llendl;
 					}
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 14583e402d53551164fa2fe91161e2fd8f3d989f..91741c2a775a727f84f9589d9f6227179420f1b5 100755
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -115,7 +115,9 @@ LLAvatarTracker::~LLAvatarTracker()
 {
 	deleteTrackingData();
 	std::for_each(mObservers.begin(), mObservers.end(), DeletePointer());
+	mObservers.clear();
 	std::for_each(mBuddyInfo.begin(), mBuddyInfo.end(), DeletePairedPointer());
+	mBuddyInfo.clear();
 }
 
 void LLAvatarTracker::track(const LLUUID& avatar_id, const std::string& name)
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp
index 8b2d9e639fefb429507f6bbf345ea6f2fd5a21af..fa23251d958d8d562ef01f21c1af6c2af56494d7 100755
--- a/indra/newview/llchannelmanager.cpp
+++ b/indra/newview/llchannelmanager.cpp
@@ -113,29 +113,33 @@ void LLChannelManager::onLoginCompleted()
 	}
 	else
 	{
-		// create a channel for the StartUp Toast
-		LLScreenChannelBase::Params p;
-		p.id = LLUUID(gSavedSettings.getString("StartUpChannelUUID"));
-		p.channel_align = CA_RIGHT;
-		mStartUpChannel = createChannel(p);
-
-		if(!mStartUpChannel)
-		{
-			onStartUpToastClose();
-		}
-		else
-		{
-			gViewerWindow->getRootView()->addChild(mStartUpChannel);
-
-			// init channel's position and size
-			S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
-			S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
-			mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
-			mStartUpChannel->setMouseDownCallback(boost::bind(&LLNotificationWellWindow::onStartUpToastClick, LLNotificationWellWindow::getInstance(), _2, _3, _4));
-
-			mStartUpChannel->setCommitCallback(boost::bind(&LLChannelManager::onStartUpToastClose, this));
-			mStartUpChannel->createStartUpToast(away_notifications, gSavedSettings.getS32("StartUpToastLifeTime"));
-		}
+		// TODO: Seems this code leads to MAINT-3536 new crash in XML_ParserFree.
+		// Need to investigate this and fix possible problems with notifications in startup time
+		// Viewer can normally receive and show of postponed notifications about purchasing in marketplace on startup time.
+		// Other types of postponed notifications did not tested.
+		//// create a channel for the StartUp Toast
+		//LLScreenChannelBase::Params p;
+		//p.id = LLUUID(gSavedSettings.getString("StartUpChannelUUID"));
+		//p.channel_align = CA_RIGHT;
+		//mStartUpChannel = createChannel(p);
+
+		//if(!mStartUpChannel)
+		//{
+		//	onStartUpToastClose();
+		//}
+		//else
+		//{
+		//	gViewerWindow->getRootView()->addChild(mStartUpChannel);
+
+		//	// init channel's position and size
+		//	S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
+		//	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+		//	mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
+		//	mStartUpChannel->setMouseDownCallback(boost::bind(&LLNotificationWellWindow::onStartUpToastClick, LLNotificationWellWindow::getInstance(), _2, _3, _4));
+
+		//	mStartUpChannel->setCommitCallback(boost::bind(&LLChannelManager::onStartUpToastClose, this));
+		//	mStartUpChannel->createStartUpToast(away_notifications, gSavedSettings.getS32("StartUpToastLifeTime"));
+		//}
 	}
 
 	LLPersistentNotificationStorage::getInstance()->loadNotifications();
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 2eb4074c97bac596dfd1af1ff165d48fa32dd086..abeaf958ebab2c29b61b6d9556cbdf68cc5e97e3 100755
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -187,6 +187,10 @@ class LLChatHistoryHeader: public LLPanel
 		{
 			LLAvatarActions::offerTeleport(getAvatarId());
 		}
+		else if (level == "request_teleport")
+		{
+			LLAvatarActions::teleportRequest(getAvatarId());
+		}
 		else if (level == "voice_call")
 		{
 			LLAvatarActions::startCall(getAvatarId());
@@ -547,7 +551,9 @@ class LLChatHistoryHeader: public LLPanel
 				menu->setItemEnabled("Send IM", false);
 				menu->setItemEnabled("Remove Friend", false);
 				menu->setItemEnabled("Offer Teleport",false);
+				menu->setItemEnabled("Request Teleport",false);
 				menu->setItemEnabled("Voice Call", false);
+				menu->setItemEnabled("Chat History", false);
 				menu->setItemEnabled("Invite Group", false);
 				menu->setItemEnabled("Zoom In", false);
 				menu->setItemEnabled("Share", false);
@@ -563,6 +569,7 @@ class LLChatHistoryHeader: public LLPanel
 				menu->setItemVisible("Send IM", false);
 			}
 				menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
+				menu->setItemEnabled("Request Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
 				menu->setItemEnabled("Voice Call", LLAvatarActions::canCall());
 
 				// We should only show 'Zoom in' item in a nearby chat
@@ -570,9 +577,9 @@ class LLChatHistoryHeader: public LLPanel
 				menu->setItemVisible("Zoom In", should_show_zoom && gObjectList.findObject(mAvatarID));	
 				menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID));
 				menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID));
+				menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID));
 			}
 
-			menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID));
 			menu->setItemEnabled("Map", (LLAvatarTracker::instance().isBuddyOnline(mAvatarID) && is_agent_mappable(mAvatarID)) || gAgent.isGodlike() );
 			menu->buildDrawLabels();
 			menu->updateParent(LLMenuGL::sMenuContainer);
@@ -724,6 +731,7 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
 	editor_params.follows.flags = FOLLOWS_ALL;
 	editor_params.enabled = false; // read only
 	editor_params.show_context_menu = "true";
+	editor_params.trusted_content = false;
 	mEditor = LLUICtrlFactory::create<LLTextEditor>(editor_params, this);
 	mEditor->setIsFriendCallback(LLAvatarActions::isFriend);
 }
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index e86d6930e89025c04ebb19a369fdb2f99758c89a..e200e0ee9ed8e4fe8caf8bea674163adcd9d8025 100755
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -43,7 +43,7 @@
 #include "llpaneloutfitedit.h"
 #include "lltrans.h"
 
-static LLRegisterPanelClassWrapper<LLCOFWearables> t_cof_wearables("cof_wearables");
+static LLPanelInjector<LLCOFWearables> t_cof_wearables("cof_wearables");
 
 const LLSD REARRANGE = LLSD().with("rearrange", LLSD());
 
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index 82d3fe74c00ef264b317f2d2aa69c536f07b8ba7..90800fee5877b8b85ede0c810e7933ec5beb6718 100644
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -267,7 +267,6 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask )
     //This node (conversation) was selected and a child (participant) was not
     if(result && getRoot())
     {
-
 		if(getRoot()->getCurSelectedItem() == this)
 		{
 			LLConversationItem* item = dynamic_cast<LLConversationItem *>(getViewModelItem());
@@ -282,7 +281,6 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask )
 			{
 				im_container->collapseMessagesPane(false);
 			}
-
 		}
 		selectConversationItem();
     }
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index 8926f64c64f30ec445c85de0a2b6f97d0601d67f..0bc7ae766c9cedadc61b0d7eb534c2b9d3c36afd 100755
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -37,8 +37,6 @@
 #include "llviewershadermgr.h"
 #include "llrender.h"
 
-#define GE_FORCE_WORKAROUND LL_DARWIN
-
 static LLGLSLShader* simple_shader = NULL;
 static LLGLSLShader* fullbright_shader = NULL;
 
@@ -660,14 +658,6 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
 	} 
 	else 
 	{	
-
-// Work-around until we can figure out why the right shader causes
-// the GeForce driver to go tango uniform on OS X 10.6.8 only
-//
-#if GE_FORCE_WORKAROUND
-		gObjectFullbrightAlphaMaskProgram.bind();
-		gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
-#else
 		if (LLPipeline::sUnderWaterRender)
 		{
 			gDeferredFullbrightAlphaMaskWaterProgram.bind();
@@ -678,9 +668,7 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
 			gDeferredFullbrightAlphaMaskProgram.bind();
 			gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
 		}
-#endif
 	}
-
 }
 
 void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
@@ -699,13 +687,6 @@ void LLDrawPoolFullbrightAlphaMask::endPostDeferredPass(S32 pass)
 	}
 	else
 	{
-
-// Work-around until we can figure out why the right shader causes
-// the GeForce driver to go tango uniform on OS X 10.6.8 only
-//
-#if GE_FORCE_WORKAROUND		
-		gObjectFullbrightAlphaMaskProgram.unbind();
-#else
 		if (LLPipeline::sUnderWaterRender)
 		{
 			gDeferredFullbrightAlphaMaskWaterProgram.unbind();
@@ -714,8 +695,6 @@ void LLDrawPoolFullbrightAlphaMask::endPostDeferredPass(S32 pass)
 		{
 			gDeferredFullbrightAlphaMaskProgram.unbind();
 		}
-#endif
-
 	}
 	LLRenderPass::endRenderPass(pass);
 }
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 73607e100a150240cadbd276ac9ec77b1ece617e..ba6f26d3efa7fb2c59dc00ba1d86387861c2157b 100755
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -925,6 +925,14 @@ void LLFeatureManager::applyBaseMasks()
 		maskFeatures("VRAMGT512");
 	}
 
+#if LL_DARWIN
+	const LLOSInfo& osInfo = LLAppViewer::instance()->getOSInfo();
+	if (osInfo.mMajorVer == 10 && osInfo.mMinorVer < 7)
+	{
+		maskFeatures("OSX_10_6_8");
+        }
+#endif
+
 	// now mask by gpu string
 	// Replaces ' ' with '_' in mGPUString to deal with inability for parser to handle spaces
 	std::string gpustr = mGPUString;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index fea8e34729e131acea20aa70213df227e135592a..4331a63346ae705f9ca807403639399ed5d3c5ed 100755
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -70,8 +70,6 @@
 extern LLMemoryInfo gSysMemory;
 extern U32 gPacketsIn;
 
-static std::string get_viewer_release_notes_url();
-
 ///----------------------------------------------------------------------------
 /// Class LLServerReleaseNotesURLFetcher
 ///----------------------------------------------------------------------------
@@ -108,8 +106,6 @@ class LLFloaterAbout
 	static LLSD getInfo();
 	void onClickCopyToClipboard();
 
-	void updateServerReleaseNotesURL(const std::string& url);
-
 private:
 	void setSupportText(const std::string& server_release_notes_url);
 };
@@ -219,107 +215,9 @@ BOOL LLFloaterAbout::postBuild()
 	return TRUE;
 }
 
-// static
 LLSD LLFloaterAbout::getInfo()
 {
-	// The point of having one method build an LLSD info block and the other
-	// construct the user-visible About string is to ensure that the same info
-	// is available to a getInfo() caller as to the user opening
-	// LLFloaterAbout.
-	LLSD info;
-	LLSD version;
-	version.append(LLVersionInfo::getMajor());
-	version.append(LLVersionInfo::getMinor());
-	version.append(LLVersionInfo::getPatch());
-	version.append(LLVersionInfo::getBuild());
-	info["VIEWER_VERSION"] = version;
-	info["VIEWER_VERSION_STR"] = LLVersionInfo::getVersion();
-	info["BUILD_DATE"] = __DATE__;
-	info["BUILD_TIME"] = __TIME__;
-	info["CHANNEL"] = LLVersionInfo::getChannel();
-
-	info["VIEWER_RELEASE_NOTES_URL"] = get_viewer_release_notes_url();
-
-#if LL_MSVC
-	info["COMPILER"] = "MSVC";
-	info["COMPILER_VERSION"] = _MSC_VER;
-#elif LL_GNUC
-	info["COMPILER"] = "GCC";
-	info["COMPILER_VERSION"] = GCC_VERSION;
-#endif
-
-	// Position
-	LLViewerRegion* region = gAgent.getRegion();
-	if (region)
-	{
-		LLVector3d pos = gAgent.getPositionGlobal();
-		info["POSITION"] = ll_sd_from_vector3d(pos);
-		info["POSITION_LOCAL"] = ll_sd_from_vector3(gAgent.getPosAgentFromGlobal(pos));
-		info["REGION"] = gAgent.getRegion()->getName();
-		info["HOSTNAME"] = gAgent.getRegion()->getHost().getHostName();
-		info["HOSTIP"] = gAgent.getRegion()->getHost().getString();
-		info["SERVER_VERSION"] = gLastVersionChannel;
-		LLSLURL slurl;
-		LLAgentUI::buildSLURL(slurl);
-		info["SLURL"] = slurl.getSLURLString();
-	}
-
-	// CPU
-	info["CPU"] = gSysCPU.getCPUString();
-	info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB() / 1024);
-	// Moved hack adjustment to Windows memory size into llsys.cpp
-	info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString();
-	info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR));
-	info["GRAPHICS_CARD"] = (const char*)(glGetString(GL_RENDERER));
-
-#if LL_WINDOWS
-    LLSD driver_info = gDXHardware.getDisplayInfo();
-    if (driver_info.has("DriverVersion"))
-    {
-        info["GRAPHICS_DRIVER_VERSION"] = driver_info["DriverVersion"];
-    }
-#endif
-
-	info["OPENGL_VERSION"] = (const char*)(glGetString(GL_VERSION));
-	info["LIBCURL_VERSION"] = LLCurl::getVersionString();
-	info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
-	bool want_fullname = true;
-	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
-	if(LLVoiceClient::getInstance()->voiceEnabled())
-	{
-		LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
-		std::ostringstream version_string;
-		version_string << version.serverType << " " << version.serverVersion << std::endl;
-		info["VOICE_VERSION"] = version_string.str();
-	}
-	else 
-	{
-		info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
-	}
-	
-	// TODO: Implement media plugin version query
-	info["QT_WEBKIT_VERSION"] = "4.7.1 (version number hard-coded)";
-
-	if (gPacketsIn > 0)
-	{
-		info["PACKETS_LOST"] = LLViewerStats::getInstance()->mPacketsLostStat.getCurrent();
-		info["PACKETS_IN"] = F32(gPacketsIn);
-		info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal();
-	}
-
-    return info;
-}
-
-static std::string get_viewer_release_notes_url()
-{
-	// return a URL to the release notes for this viewer, such as:
-	// http://wiki.secondlife.com/wiki/Release_Notes/Second Life Beta Viewer/2.1.0.123456
-	std::string url = LLTrans::getString("RELEASE_NOTES_BASE_URL");
-	if (! LLStringUtil::endsWith(url, "/"))
-		url += "/";
-	url += LLVersionInfo::getChannel() + "/";
-	url += LLVersionInfo::getVersion();
-	return LLWeb::escapeURL(url);
+	return LLAppViewer::instance()->getViewerInfo();
 }
 
 class LLFloaterAboutListener: public LLEventAPI
@@ -356,93 +254,22 @@ void LLFloaterAbout::onClickCopyToClipboard()
 	support_widget->deselect();
 }
 
-void LLFloaterAbout::updateServerReleaseNotesURL(const std::string& url)
-{
-	setSupportText(url);
-}
-
 void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url)
 {
 #if LL_WINDOWS
 	getWindow()->incBusyCount();
 	getWindow()->setCursor(UI_CURSOR_ARROW);
 #endif
-	LLSD info(getInfo());
 #if LL_WINDOWS
 	getWindow()->decBusyCount();
 	getWindow()->setCursor(UI_CURSOR_ARROW);
 #endif
 
-	if (LLStringUtil::startsWith(server_release_notes_url, "http")) // it's an URL
-	{
-		info["SERVER_RELEASE_NOTES_URL"] = "[" + LLWeb::escapeURL(server_release_notes_url) + " " + LLTrans::getString("ReleaseNotes") + "]";
-	}
-	else
-	{
-		info["SERVER_RELEASE_NOTES_URL"] = server_release_notes_url;
-	}
-
 	LLViewerTextEditor *support_widget =
 		getChild<LLViewerTextEditor>("support_editor", true);
 
-	std::ostringstream support;
-
-	// Render the LLSD from getInfo() as a format_map_t
-	LLStringUtil::format_map_t args;
-
-	// allow the "Release Notes" URL label to be localized
-	args["ReleaseNotes"] = LLTrans::getString("ReleaseNotes");
-
-	for (LLSD::map_const_iterator ii(info.beginMap()), iend(info.endMap());
-		 ii != iend; ++ii)
-	{
-		if (! ii->second.isArray())
-		{
-			// Scalar value
-			if (ii->second.isUndefined())
-			{
-				args[ii->first] = getString("none");
-			}
-			else
-			{
-				// don't forget to render value asString()
-				args[ii->first] = ii->second.asString();
-			}
-		}
-		else
-		{
-			// array value: build KEY_0, KEY_1 etc. entries
-			for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n)
-			{
-				args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString();
-			}
-		}
-	}
-
-	// Now build the various pieces
-	support << getString("AboutHeader", args);
-	if (info.has("REGION"))
-	{
-		support << "\n\n" << getString("AboutPosition", args);
-	}
-	support << "\n\n" << getString("AboutSystem", args);
-	support << "\n";
-	if (info.has("GRAPHICS_DRIVER_VERSION"))
-	{
-		support << "\n" << getString("AboutDriver", args);
-	}
-	support << "\n" << getString("AboutLibs", args);
-	if (info.has("COMPILER"))
-	{
-		support << "\n" << getString("AboutCompiler", args);
-	}
-	if (info.has("PACKETS_IN"))
-	{
-		support << '\n' << getString("AboutTraffic", args);
-	}
-
 	support_widget->clear();
-	support_widget->appendText(support.str(),
+	support_widget->appendText(LLAppViewer::instance()->getViewerInfoString(),
 								FALSE,
 								LLStyle::Params()
 									.color(LLUIColorTable::instance().getColor("TextFgReadOnlyColor")));
@@ -489,9 +316,9 @@ void LLServerReleaseNotesURLFetcher::completedHeader(U32 status, const std::stri
 		std::string location = content["location"].asString();
 		if (location.empty())
 		{
-			location = floater_about->getString("ErrorFetchingServerReleaseNotesURL");
+			location = LLTrans::getString("ErrorFetchingServerReleaseNotesURL");
 		}
-		floater_about->updateServerReleaseNotesURL(location);
+		LLAppViewer::instance()->setServerReleaseNotesURL(location);
 	}
 }
 
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index 76f62a7880a3c9aee0a1c42873c3f1b435fafadf..07bd262c00a37943dc8a67935ab1f82021310b6c 100755
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -82,6 +82,11 @@ BOOL LLFloaterBulkPermission::postBuild()
 	mBulkChangeNextOwnerCopy = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy");
 	mBulkChangeNextOwnerTransfer = gSavedSettings.getBOOL("BulkChangeNextOwnerTransfer");
 
+	// fix invalid permissions case (in case initial settings were generated by a viewer affected by MAINT-3339)
+	if( !mBulkChangeNextOwnerTransfer && !mBulkChangeEveryoneCopy)
+	{
+		mBulkChangeNextOwnerTransfer = true;
+	}
 	return TRUE;
 }
 
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index c85d048c5a9163aa98848ac7161b3cb210f3e5db..d0939b3eee5f7ddcecc353ad5d3b7caf2ca2f625 100755
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -151,7 +151,7 @@ void LLPanelCameraItem::setValue(const LLSD& value)
 	getChildView("selected_picture")->setVisible( value["selected"]);
 }
 
-static LLRegisterPanelClassWrapper<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel");
+static LLPanelInjector<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel");
 
 //-------------------------------------------------------------------------------
 // LLPanelCameraZoom
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index b5aa309066afd22107d1926fde325c84eee63d13..566f9bc9cc96e6ce3c894a4ba6e3e94c744d556a 100755
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -88,12 +88,10 @@ LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed, const Params& param
 LLFloaterIMContainer::~LLFloaterIMContainer()
 {
 	mConversationsEventStream.stopListening("ConversationsRefresh");
-
 	gIdleCallbacks.deleteFunction(idle, this);
-
 	mNewMessageConnection.disconnect();
 	LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
-
+	
 	if (mMicroChangedSignal.connected())
 	{
 		mMicroChangedSignal.disconnect();
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 0ccfdb9a7be79718c1c8f1a55f29c61fd2b2e06e..29511f56ff17f76ca2d318ffaf1f773bbcb0341e 100755
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -825,6 +825,7 @@ void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
 void LLFloaterIMSessionTab::onSlide(LLFloaterIMSessionTab* self)
 {
 	LLFloaterIMContainer* host_floater = dynamic_cast<LLFloaterIMContainer*>(self->getHost());
+	bool should_be_expanded = false;
 	if (host_floater)
 	{
 		// Hide the messages pane if a floater is hosted in the Conversations
@@ -835,7 +836,7 @@ void LLFloaterIMSessionTab::onSlide(LLFloaterIMSessionTab* self)
 		if (!self->mIsP2PChat)
 		{
             // The state must toggle the collapsed state of the panel
-            bool should_be_expanded = self->mParticipantListPanel->isCollapsed();
+           should_be_expanded = self->mParticipantListPanel->isCollapsed();
 
 			// Update the expand/collapse flag of the participant list panel and save it
             gSavedSettings.setBOOL("IMShowControlPanel", should_be_expanded);
@@ -847,6 +848,10 @@ void LLFloaterIMSessionTab::onSlide(LLFloaterIMSessionTab* self)
 	}
 
 	self->assignResizeLimits();
+	if (should_be_expanded)
+	{
+		self->forceReshape();
+	}
 }
 
 void LLFloaterIMSessionTab::onCollapseToLine(LLFloaterIMSessionTab* self)
diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp
index b0009fd94f34b249569c6c4809c2bf8542ef189e..f0c010b545a3cc37b41fd027cea26aa0b138fb05 100755
--- a/indra/newview/llfloaterpay.cpp
+++ b/indra/newview/llfloaterpay.cpp
@@ -135,6 +135,7 @@ LLFloaterPay::LLFloaterPay(const LLSD& key)
 LLFloaterPay::~LLFloaterPay()
 {
 	std::for_each(mCallbackData.begin(), mCallbackData.end(), DeletePointer());
+	mCallbackData.clear();
 	// Name callbacks will be automatically disconnected since LLFloater is trackable
 	
 	// In case this floater is currently waiting for a reply.
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 87ae36716d4ef073f35f53db68a8b3bb5224d337..b50a2e6f853b2fb4d172f35eafdc3caff84bd0d6 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -238,6 +238,7 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response
 
 void handleNameTagOptionChanged(const LLSD& newvalue)
 {
+	LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
 	LLVOAvatar::invalidateNameTags();
 }
 
@@ -1822,7 +1823,7 @@ class LLPanelPreference::Updater : public LLEventTimer
 	callback_t mCallback;
 };
 //----------------------------------------------------------------------------
-static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
+static LLPanelInjector<LLPanelPreference> t_places("panel_preference");
 LLPanelPreference::LLPanelPreference()
 : LLPanel(),
   mBandWidthUpdater(NULL)
@@ -2062,8 +2063,8 @@ class LLPanelPreferencePrivacy : public LLPanelPreference
 	std::list<std::string> mAccountIndependentSettings;
 };
 
-static LLRegisterPanelClassWrapper<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
-static LLRegisterPanelClassWrapper<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
+static LLPanelInjector<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
+static LLPanelInjector<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
 
 BOOL LLPanelPreferenceGraphics::postBuild()
 {
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index 2a74c8e3eac8f145a9de54d7fe8d5183041ae6ab..e8c6b179cfa24ddf29074aee7005169ecca67e31 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -47,10 +47,10 @@
 #include "llviewercontrol.h"
 #include "llviewermedia.h"
 
-static LLRegisterPanelClassWrapper<LLSocialStatusPanel> t_panel_status("llsocialstatuspanel");
-static LLRegisterPanelClassWrapper<LLSocialPhotoPanel> t_panel_photo("llsocialphotopanel");
-static LLRegisterPanelClassWrapper<LLSocialCheckinPanel> t_panel_checkin("llsocialcheckinpanel");
-static LLRegisterPanelClassWrapper<LLSocialAccountPanel> t_panel_account("llsocialaccountpanel");
+static LLPanelInjector<LLSocialStatusPanel> t_panel_status("llsocialstatuspanel");
+static LLPanelInjector<LLSocialPhotoPanel> t_panel_photo("llsocialphotopanel");
+static LLPanelInjector<LLSocialCheckinPanel> t_panel_checkin("llsocialcheckinpanel");
+static LLPanelInjector<LLSocialAccountPanel> t_panel_account("llsocialaccountpanel");
 
 const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
 const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/";
@@ -170,7 +170,6 @@ mRefreshBtn(NULL),
 mWorkingLabel(NULL),
 mThumbnailPlaceholder(NULL),
 mCaptionTextBox(NULL),
-mLocationCheckbox(NULL),
 mPostButton(NULL)
 {
 	mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLSocialPhotoPanel::onSend, this));
@@ -196,7 +195,6 @@ BOOL LLSocialPhotoPanel::postBuild()
     mWorkingLabel = getChild<LLUICtrl>("working_lbl");
 	mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
 	mCaptionTextBox = getChild<LLUICtrl>("photo_caption");
-	mLocationCheckbox = getChild<LLUICtrl>("add_location_cb");
 	mPostButton = getChild<LLUICtrl>("post_photo_btn");
 	mCancelButton = getChild<LLUICtrl>("cancel_photo_btn");
 
@@ -213,7 +211,6 @@ void LLSocialPhotoPanel::draw()
     mCaptionTextBox->setEnabled(no_ongoing_connection);
     mResolutionComboBox->setEnabled(no_ongoing_connection);
     mRefreshBtn->setEnabled(no_ongoing_connection);
-    mLocationCheckbox->setEnabled(no_ongoing_connection);
     
     // Display the preview if one is available
 	if (previewp && previewp->getThumbnailImage())
@@ -343,25 +340,6 @@ void LLSocialPhotoPanel::sendPhoto()
 	// Get the caption
 	std::string caption = mCaptionTextBox->getValue().asString();
 
-	// Add the location if required
-	bool add_location = mLocationCheckbox->getValue().asBoolean();
-	if (add_location)
-	{
-		// Get the SLURL for the location
-		LLSLURL slurl;
-		LLAgentUI::buildSLURL(slurl);
-		std::string slurl_string = slurl.getSLURLString();
-
-		// Add query parameters so Google Analytics can track incoming clicks!
-		slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS;
-
-		// Add it to the caption (pretty crude, but we don't have a better option with photos)
-		if (caption.empty())
-			caption = slurl_string;
-		else
-			caption = caption + " " + slurl_string;
-	}
-
 	// Get the image
 	LLSnapshotLivePreview* previewp = getPreviewView();
 	
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index bbe07c970406ec6b4daa1689ad9ed6dcd6e7beef..309f015ce972704f47795b3bab4a4b6f46cc8639 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -85,7 +85,6 @@ class LLSocialPhotoPanel : public LLPanel
 	LLUICtrl * mWorkingLabel;
 	LLUICtrl * mThumbnailPlaceholder;
 	LLUICtrl * mCaptionTextBox;
-	LLUICtrl * mLocationCheckbox;
 	LLUICtrl * mPostButton;
 	LLUICtrl* mCancelButton;
 };
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index 324afe661fc1f510f9c447d0de7d3283dc2e0073..a025a859e7de67623b99d5a40798b3a3bb83d967 100755
--- a/indra/newview/llfloatertoybox.cpp
+++ b/indra/newview/llfloatertoybox.cpp
@@ -107,7 +107,7 @@ void LLFloaterToybox::draw()
 	{
 		const LLCommandId& id = *it;
 
-		const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarView::TOOLBAR_NONE);
+		const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarEnums::TOOLBAR_NONE);
 		mToolBar->enableCommand(id, command_not_present);
 	}
 
@@ -175,9 +175,9 @@ void LLFloaterToybox::onToolBarButtonEnter(LLView* button)
 
 		switch(command_loc)
 		{
-		case LLToolBarView::TOOLBAR_BOTTOM:	suffix = LLTrans::getString("Toolbar_Bottom_Tooltip");	break;
-		case LLToolBarView::TOOLBAR_LEFT:	suffix = LLTrans::getString("Toolbar_Left_Tooltip");	break;
-		case LLToolBarView::TOOLBAR_RIGHT:	suffix = LLTrans::getString("Toolbar_Right_Tooltip");	break;
+		case LLToolBarEnums::TOOLBAR_BOTTOM:	suffix = LLTrans::getString("Toolbar_Bottom_Tooltip");	break;
+		case LLToolBarEnums::TOOLBAR_LEFT:	suffix = LLTrans::getString("Toolbar_Left_Tooltip");	break;
+		case LLToolBarEnums::TOOLBAR_RIGHT:	suffix = LLTrans::getString("Toolbar_Right_Tooltip");	break;
 
 		default:
 			break;
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 60fa53f491c1d94b9d6e2018a5a1e330f2eb4260..c4c18272663398ad6f56627cf9b17d8c0cdef7f2 100755
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -62,6 +62,7 @@
 #include "llresmgr.h"
 #include "pipeline.h"
 #include "llspatialpartition.h"
+#include "llviewershadermgr.h"
 
 // Height of the yellow selection highlight posts for land
 const F32 PARCEL_POST_HEIGHT = 0.666f;
@@ -767,7 +768,6 @@ void draw_line_cube(F32 width, const LLVector3& center)
 	gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
 }
 
-
 void LLViewerObjectList::renderObjectBeacons()
 {
 	if (mDebugBeacons.empty())
@@ -878,3 +878,134 @@ void LLViewerObjectList::renderObjectBeacons()
 }
 
 
+void gpu_benchmark()
+{
+	if (!LLGLSLShader::sNoFixedFunction)
+	{ //don't bother benchmarking the fixed function
+		return;
+	}
+
+	//measure memory bandwidth by:
+	// - allocating a batch of textures and render targets
+	// - rendering those textures to those render targets
+	// - recording time taken
+	// - taking the median time for a given number of samples
+	
+	//resolution of textures/render targets
+	const U32 res = 1024;
+	
+	//number of textures
+	const U32 count = 32;
+
+	//number of samples to take
+	const S32 samples = 64;
+
+	LLGLSLShader::initProfile();
+
+	LLRenderTarget dest[count];
+	U32 source[count];
+	LLImageGL::generateTextures(count, source);
+	std::vector<F32> results;
+
+	//build a random texture
+	U8 pixels[res*res*4];
+
+	for (U32 i = 0; i < res*res*4; ++i)
+	{
+		pixels[i] = (U8) ll_rand(255);
+	}
+	
+
+	gGL.setColorMask(true, true);
+	LLGLDepthTest depth(GL_FALSE);
+
+	for (U32 i = 0; i < count; ++i)
+	{ //allocate render targets and textures
+		dest[i].allocate(res,res,GL_RGBA,false, false, LLTexUnit::TT_TEXTURE, true);
+		dest[i].bindTarget();
+		dest[i].clear();
+		dest[i].flush();
+
+		gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, source[i]);
+		LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+	}
+
+	//make a dummy triangle to draw with
+	LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, GL_STATIC_DRAW_ARB);
+	buff->allocateBuffer(3, 0, true);
+
+	LLStrider<LLVector3> v;
+	LLStrider<LLVector2> tc;
+
+	buff->getVertexStrider(v);
+	
+	v[0].set(-1,1,0);
+	v[1].set(-1,-3,0);
+	v[2].set(3,1,0);
+	buff->flush();
+
+	gBenchmarkProgram.bind();
+	buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
+	//wait for any previoius GL commands to finish
+	glFinish();
+	
+	for (S32 c = -1; c < samples; ++c)
+	{
+		LLTimer timer;
+		timer.start();
+
+		for (U32 i = 0; i < count; ++i)
+		{
+			dest[i].bindTarget();
+			gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, source[i]);
+			buff->drawArrays(LLRender::TRIANGLES, 0, 3);
+			dest[i].flush();
+		}
+		
+		//wait for current batch of copies to finish
+		glFinish();
+
+		F32 time = timer.getElapsedTimeF32();
+
+		if (c >= 0) // <-- ignore the first sample as it tends to be artificially slow
+		{ 
+			//store result in gigabytes per second
+			F32 gb = (F32) ((F64) (res*res*8*count))/(1000000000);
+
+			F32 gbps = gb/time;
+
+			results.push_back(gbps);
+		}
+	}
+
+	gBenchmarkProgram.unbind();
+
+	LLGLSLShader::finishProfile();
+	
+	LLImageGL::deleteTextures(count, source);
+
+
+	std::sort(results.begin(), results.end());
+
+	F32 gbps = results[results.size()/2];
+
+	llinfos << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to CPU timers" << llendl;
+	
+	F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
+	F32 seconds = ms/1000.f;
+
+	F64 samples_drawn = res*res*count*samples;
+	F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
+	gbps = samples_sec*8;
+
+	if (gGLManager.mHasTimerQuery)
+	{
+		llinfos << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << llendl;
+	}
+	else
+	{
+		llinfos << "ARB_timer_query unavailable." << llendl;
+	}
+}
+
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index cbd844cdac07743deb4a444a3a602a5b5b44cdf3..7ea08539f94ca85be4282f5a929b62ae36619a2f 100755
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -77,6 +77,7 @@ LLRoleActionSet::~LLRoleActionSet()
 {
 	delete mActionSetData;
 	std::for_each(mActions.begin(), mActions.end(), DeletePointer());
+	mActions.clear();
 }
 
 //
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 9ffbd1a6752ce9cde6488777024d9b436660aeca..70ffdc14ff78cdf795c98b03946c2dd728f9cf9e 100755
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1959,11 +1959,11 @@ LLDockControl::DocAt LLCallDialog::getDockControlPos(const std::string& toolbarB
 	
 	switch (toolbar_loc)
 	{
-		case LLToolBarView::TOOLBAR_LEFT:
+		case LLToolBarEnums::TOOLBAR_LEFT:
 			doc_at = LLDockControl::RIGHT;
 			break;
 			
-		case LLToolBarView::TOOLBAR_RIGHT:
+		case LLToolBarEnums::TOOLBAR_RIGHT:
 			doc_at = LLDockControl::LEFT;
 			break;
 	}
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 3c6974cf6d3a4eefbc5ba69cac47e50523ad1455..15463e0d33c93e6ea4726ee4d84a8f0e64a9f8d6 100755
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -139,7 +139,14 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
 	{
 		return passed_clipboard;
 	}
-	
+
+	// show folder links
+	LLViewerInventoryItem* item = gInventory.getItem(folder_id);
+	if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER)
+	{
+		return passed_clipboard;
+	}
+
 	if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY)
 	{
 		// Can only filter categories for items in your inventory
diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp
index dd402de394a9564037492d74123440e8d417c7d8..a92df8250eb9eee7cb65c73eeb974e55f3b8f9ef 100755
--- a/indra/newview/lllandmarklist.cpp
+++ b/indra/newview/lllandmarklist.cpp
@@ -46,6 +46,7 @@ LLLandmarkList gLandmarkList;
 LLLandmarkList::~LLLandmarkList()
 {
 	std::for_each(mList.begin(), mList.end(), DeletePairedPointer());
+	mList.clear();
 }
 
 LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t cb)
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 32b168b8c516749efa095e8f67af29a4fbffed46..8bddf49fb5379c92b9e33b61c6a4a7a8e42250e7 100755
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -698,14 +698,14 @@ void LLPanelStandStopFlying::updatePosition()
 
 	S32 y_pos = 0;
 	S32 bottom_tb_center = 0;
-	if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarView::TOOLBAR_BOTTOM))
+	if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
 	{
 		y_pos = toolbar_bottom->getRect().getHeight();
 		bottom_tb_center = toolbar_bottom->getRect().getCenterX();
 	}
 
 	S32 left_tb_width = 0;
-	if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarView::TOOLBAR_LEFT))
+	if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
 	{
 		left_tb_width = toolbar_left->getRect().getWidth();
 	}
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index c15b6bd0d35020c33f10033592d0e42f56fb7aad..ff8bfafb791da2fd4a87f61f0032e27e580d00ec 100755
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -343,7 +343,7 @@ class LLOutfitContextMenu : public LLListContextMenu
 
 //////////////////////////////////////////////////////////////////////////
 
-static LLRegisterPanelClassWrapper<LLOutfitsList> t_outfits_list("outfits_list");
+static LLPanelInjector<LLOutfitsList> t_outfits_list("outfits_list");
 
 LLOutfitsList::LLOutfitsList()
 	:	LLPanelAppearanceTab()
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 115114bb53ba5f3fa2171b299855a7bb19575855..9665314e7535c9ab0a04e5c876c9899ca0406f6a 100755
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -48,7 +48,7 @@
 #include "llsidetraypanelcontainer.h"
 #include "llviewercontrol.h"
 
-static LLRegisterPanelClassWrapper<LLPanelBlockedList> t_panel_blocked_list("panel_block_list_sidetray");
+static LLPanelInjector<LLPanelBlockedList> t_panel_blocked_list("panel_block_list_sidetray");
 
 //
 // Constants
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index e71dba5caee73871c17c7e9d531ceeed95a2b2a2..0621cc8fad1e7e1e76bc1a6f84418016f1a66128 100755
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -62,7 +62,7 @@
 #include "llappearancemgr.h"
 
 // register panel with appropriate XML
-static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
+static LLPanelInjector<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
 
 // subparts of the UI for focus, camera position, etc.
 enum ESubpart {
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index ae217958f0e90fa111ce595f64c29637531b23b9..180c1d6ab557d7c20df081c6e9aec2364d540833 100755
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -55,7 +55,7 @@
 
 #include "lltrans.h"
 
-static LLRegisterPanelClassWrapper<LLPanelGroup> t_panel_group("panel_group_info_sidetray");
+static LLPanelInjector<LLPanelGroup> t_panel_group("panel_group_info_sidetray");
 
 
 
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 0cd93b330ad2ff1593ebebc9cb25f1ae0b50ae77..eaf33c71086a83d6ee20fb788c4be27dc997b1cf 100755
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -53,7 +53,7 @@
 #include "lltrans.h"
 #include "llviewerwindow.h"
 
-static LLRegisterPanelClassWrapper<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
+static LLPanelInjector<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
 
 // consts
 const S32 MATURE_CONTENT = 1;
@@ -63,14 +63,12 @@ const S32 DECLINE_TO_STATE = 0;
 
 LLPanelGroupGeneral::LLPanelGroupGeneral()
 :	LLPanelGroupTab(),
-	mPendingMemberUpdate(FALSE),
 	mChanged(FALSE),
 	mFirstUse(TRUE),
 	mGroupNameEditor(NULL),
 	mFounderName(NULL),
 	mInsignia(NULL),
 	mEditCharter(NULL),
-	mListVisibleMembers(NULL),
 	mCtrlShowInGroupList(NULL),
 	mComboMature(NULL),
 	mCtrlOpenEnrollment(NULL),
@@ -79,18 +77,13 @@ LLPanelGroupGeneral::LLPanelGroupGeneral()
 	mCtrlReceiveNotices(NULL),
 	mCtrlListGroup(NULL),
 	mActiveTitleLabel(NULL),
-	mComboActiveTitle(NULL),
-	mAvatarNameCacheConnection()
+	mComboActiveTitle(NULL)
 {
 
 }
 
 LLPanelGroupGeneral::~LLPanelGroupGeneral()
 {
-	if (mAvatarNameCacheConnection.connected())
-	{
-		mAvatarNameCacheConnection.disconnect();
-	}
 }
 
 BOOL LLPanelGroupGeneral::postBuild()
@@ -105,17 +98,6 @@ BOOL LLPanelGroupGeneral::postBuild()
 		mEditCharter->setFocusChangedCallback(boost::bind(onFocusEdit, _1, this));
 	}
 
-
-
-	mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
-	if (mListVisibleMembers)
-	{
-		mListVisibleMembers->setDoubleClickCallback(openProfile, this);
-		mListVisibleMembers->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
-		
-		mListVisibleMembers->setSortCallback(boost::bind(&LLPanelGroupGeneral::sortMembersList,this,_1,_2,_3));
-	}
-
 	// Options
 	mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
 	if (mCtrlShowInGroupList)
@@ -290,21 +272,6 @@ void LLPanelGroupGeneral::onClickInfo(void *userdata)
 
 }
 
-// static
-void LLPanelGroupGeneral::openProfile(void* data)
-{
-	LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
-
-	if (self && self->mListVisibleMembers)
-	{
-		LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected();
-		if (selected)
-		{
-			LLAvatarActions::showProfile(selected->getUUID());
-		}
-	}
-}
-
 bool LLPanelGroupGeneral::needsApply(std::string& mesg)
 { 
 	updateChanged();
@@ -336,11 +303,6 @@ void LLPanelGroupGeneral::activate()
 void LLPanelGroupGeneral::draw()
 {
 	LLPanelGroupTab::draw();
-
-	if (mPendingMemberUpdate)
-	{
-		updateMembers();
-	}
 }
 
 bool LLPanelGroupGeneral::apply(std::string& mesg)
@@ -522,10 +484,6 @@ bool LLPanelGroupGeneral::createGroupCallback(const LLSD& notification, const LL
 	return false;
 }
 
-static F32 sSDTime = 0.0f;
-static F32 sElementTime = 0.0f;
-static F32 sAllTime = 0.0f;
-
 // virtual
 void LLPanelGroupGeneral::update(LLGroupChange gc)
 {
@@ -666,132 +624,10 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 	{
 		mEditCharter->setText(gdatap->mCharter);
 	}
-	
-	if (mListVisibleMembers)
-	{
-		mListVisibleMembers->deleteAllItems();
-
-		if (gdatap->isMemberDataComplete())
-		{
-			mMemberProgress = gdatap->mMembers.begin();
-			mPendingMemberUpdate = TRUE;
-
-			sSDTime = 0.0f;
-			sElementTime = 0.0f;
-			sAllTime = 0.0f;
-		}
-		else
-		{
-			std::stringstream pending;
-			pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount  << ")";
-
-			LLSD row;
-			row["columns"][0]["value"] = pending.str();
-			row["columns"][0]["column"] = "name";
-
-			mListVisibleMembers->setEnabled(FALSE);
-			mListVisibleMembers->addElement(row);
-		}
-	}
 
 	resetDirty();
 }
 
-void LLPanelGroupGeneral::updateMembers()
-{
-	mPendingMemberUpdate = FALSE;
-
-	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
-	if (!mListVisibleMembers 
-		|| !gdatap 
-		|| !gdatap->isMemberDataComplete()
-		|| gdatap->mMembers.empty())
-	{
-		return;
-	}
-
-	LLTimer update_time;
-	update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
-
-	LLAvatarName av_name;
-
-	for( ; mMemberProgress != gdatap->mMembers.end() && !update_time.hasExpired(); 
-			++mMemberProgress)
-	{
-		LLGroupMemberData* member = mMemberProgress->second;
-		if (!member)
-		{
-			continue;
-		}
-
-		if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
-		{
-			addMember(mMemberProgress->second);
-		}
-		else
-		{
-			// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
-			// *TODO : Use a callback per member, not for the panel group.
-			if (mAvatarNameCacheConnection.connected())
-			{
-				mAvatarNameCacheConnection.disconnect();
-			}
-			mAvatarNameCacheConnection = LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupGeneral::onNameCache, this, gdatap->getMemberVersion(), member, _2));
-		}
-	}
-
-	if (mMemberProgress == gdatap->mMembers.end())
-	{
-		lldebugs << "   member list completed." << llendl;
-		mListVisibleMembers->setEnabled(TRUE);
-	}
-	else
-	{
-		mPendingMemberUpdate = TRUE;
-		mListVisibleMembers->setEnabled(FALSE);
-	}
-}
-
-void LLPanelGroupGeneral::addMember(LLGroupMemberData* member)
-{
-	LLNameListCtrl::NameItem item_params;
-	item_params.value = member->getID();
-
-	LLScrollListCell::Params column;
-	item_params.columns.add().column("name").font.name("SANSSERIF_SMALL");
-
-	item_params.columns.add().column("title").value(member->getTitle()).font.name("SANSSERIF_SMALL");
-
-	item_params.columns.add().column("status").value(member->getOnlineStatus()).font.name("SANSSERIF_SMALL");
-
-	LLScrollListItem* member_row = mListVisibleMembers->addNameItemRow(item_params);
-
-	if ( member->isOwner() )
-	{
-		LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(member_row->getColumn(0));
-		if (name_textp)
-			name_textp->setFontStyle(LLFontGL::BOLD);
-	}
-}
-
-void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name)
-{
-	mAvatarNameCacheConnection.disconnect();
-
-	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
-
-	if (!gdatap
-		|| !gdatap->isMemberDataComplete()
-		|| gdatap->getMemberVersion() != update_id)
-	{
-		// Stale data
-		return;
-	}
-
-	addMember(member);
-}
-
 void LLPanelGroupGeneral::updateChanged()
 {
 	// List all the controls we want to check for changes...
@@ -867,17 +703,6 @@ void LLPanelGroupGeneral::reset()
 		mEditCharter->setText(empty_str);
 		mGroupNameEditor->setText(empty_str);
 	}
-	
-	{
-		LLSD row;
-		row["columns"][0]["value"] = "no members yet";
-		row["columns"][0]["column"] = "name";
-
-		mListVisibleMembers->deleteAllItems();
-		mListVisibleMembers->setEnabled(FALSE);
-		mListVisibleMembers->addElement(row);
-	}
-
 
 	{
 		mComboMature->setEnabled(true);
@@ -964,18 +789,3 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
 
 	activate();
 }
-S32 LLPanelGroupGeneral::sortMembersList(S32 col_idx,const LLScrollListItem* i1,const LLScrollListItem* i2)
-{
-	const LLScrollListCell *cell1 = i1->getColumn(col_idx);
-	const LLScrollListCell *cell2 = i2->getColumn(col_idx);
-
-	if(col_idx == 2)
-	{
-		if(LLStringUtil::compareDict(cell1->getValue().asString(),"Online") == 0 )
-			return 1;
-		if(LLStringUtil::compareDict(cell2->getValue().asString(),"Online") == 0 )
-			return -1;
-	}
-
-	return LLStringUtil::compareDict(cell1->getValue().asString(), cell2->getValue().asString());
-}
diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h
index b7f4a011397575d92aa7e785cd0aa5bc628ff098..11972bafa98fc260537501209690d79f27746aca 100755
--- a/indra/newview/llpanelgroupgeneral.h
+++ b/indra/newview/llpanelgroupgeneral.h
@@ -62,8 +62,6 @@ class LLPanelGroupGeneral : public LLPanelGroupTab
 	virtual void setGroupID(const LLUUID& id);
 
 	virtual void setupCtrls	(LLPanel* parent);
-
-	void onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name);
 private:
 	void	reset();
 
@@ -75,18 +73,12 @@ class LLPanelGroupGeneral : public LLPanelGroupTab
 	static void onCommitEnrollment(LLUICtrl* ctrl, void* data);
 	static void onClickInfo(void* userdata);
 	static void onReceiveNotices(LLUICtrl* ctrl, void* data);
-	static void openProfile(void* data);
-
-	S32	 sortMembersList(S32,const LLScrollListItem*,const LLScrollListItem*);
-	void addMember(LLGroupMemberData* member);
 
     static bool joinDlgCB(const LLSD& notification, const LLSD& response);
 
-	void updateMembers();
 	void updateChanged();
 	bool confirmMatureApply(const LLSD& notification, const LLSD& response);
 
-	BOOL			mPendingMemberUpdate;
 	BOOL			mChanged;
 	BOOL			mFirstUse;
 	std::string		mIncompleteMemberDataStr;
@@ -97,8 +89,6 @@ class LLPanelGroupGeneral : public LLPanelGroupTab
 	LLTextureCtrl		*mInsignia;
 	LLTextEditor		*mEditCharter;
 
-	LLNameListCtrl	*mListVisibleMembers;
-
 	// Options (include any updates in updateChanged)
 	LLCheckBoxCtrl	*mCtrlShowInGroupList;
 	LLCheckBoxCtrl	*mCtrlOpenEnrollment;
@@ -109,9 +99,6 @@ class LLPanelGroupGeneral : public LLPanelGroupTab
 	LLTextBox       *mActiveTitleLabel;
 	LLComboBox		*mComboActiveTitle;
 	LLComboBox		*mComboMature;
-
-	LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
-	boost::signals2::connection mAvatarNameCacheConnection;
 };
 
 #endif
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index c927aeacb30d4b495e9110bc5501ce5595042ea4..17707557bb2cae8304c8ce32f6a2e9355386bef4 100755
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -55,7 +55,7 @@
 #include "llfloaterworldmap.h"
 #include "llviewermessage.h"
 
-static LLRegisterPanelClassWrapper<LLPanelGroupLandMoney> t_panel_group_money("panel_group_land_money");
+static LLPanelInjector<LLPanelGroupLandMoney> t_panel_group_money("panel_group_land_money");
 
 
 
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 522ba5afae403b2c17f3492adf4200ab0dbf7e09..0dfb8fef53fad5d27dbbebc423a84f4a64d0f21f 100755
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -57,7 +57,7 @@
 #include "llnotificationsutil.h"
 #include "llgiveinventory.h"
 
-static LLRegisterPanelClassWrapper<LLPanelGroupNotices> t_panel_group_notices("panel_group_notices");
+static LLPanelInjector<LLPanelGroupNotices> t_panel_group_notices("panel_group_notices");
 
 
 /////////////////////////
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index fdcd1f5ebb1fa8a8339866ec504fe934894151d2..c30c932c415c64c15b2e9e6aee67f3d93125bc2a 100755
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -55,7 +55,7 @@
 
 #include "roles_constants.h"
 
-static LLRegisterPanelClassWrapper<LLPanelGroupRoles> t_panel_group_roles("panel_group_roles");
+static LLPanelInjector<LLPanelGroupRoles> t_panel_group_roles("panel_group_roles");
 
 bool agentCanRemoveFromRole(const LLUUID& group_id,
 							const LLUUID& role_id)
@@ -733,7 +733,7 @@ void LLPanelGroupSubTab::setFooterEnabled(BOOL enable)
 ////////////////////////////
 
 
-static LLRegisterPanelClassWrapper<LLPanelGroupMembersSubTab> t_panel_group_members_subtab("panel_group_members_subtab");
+static LLPanelInjector<LLPanelGroupMembersSubTab> t_panel_group_members_subtab("panel_group_members_subtab");
 
 LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
 : 	LLPanelGroupSubTab(),
@@ -1636,6 +1636,9 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data)
 
 	item_params.columns.add().column("online").value(data->getOnlineStatus())
 			.font.name("SANSSERIF_SMALL").style("NORMAL");
+
+	item_params.columns.add().column("title").value(data->getTitle()).font.name("SANSSERIF_SMALL").style("NORMAL");;
+
 	mMembersList->addNameItemRow(item_params);
 
 	mHasMatch = TRUE;
@@ -1752,7 +1755,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
 // LLPanelGroupRolesSubTab
 ////////////////////////////
 
-static LLRegisterPanelClassWrapper<LLPanelGroupRolesSubTab> t_panel_group_roles_subtab("panel_group_roles_subtab");
+static LLPanelInjector<LLPanelGroupRolesSubTab> t_panel_group_roles_subtab("panel_group_roles_subtab");
 
 LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab()
   : LLPanelGroupSubTab(),
@@ -2466,7 +2469,7 @@ void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role)
 // LLPanelGroupActionsSubTab
 ////////////////////////////
 
-static LLRegisterPanelClassWrapper<LLPanelGroupActionsSubTab> t_panel_group_actions_subtab("panel_group_actions_subtab");
+static LLPanelInjector<LLPanelGroupActionsSubTab> t_panel_group_actions_subtab("panel_group_actions_subtab");
 
 
 LLPanelGroupActionsSubTab::LLPanelGroupActionsSubTab()
@@ -2658,7 +2661,7 @@ void LLPanelGroupRoles::setGroupID(const LLUUID& id)
 		button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
 
 	if(mSubTabContainer)
-		mSubTabContainer->selectTab(0);
+		mSubTabContainer->selectTab(1);
 
 	activate();
 }
diff --git a/indra/newview/llpanelhome.cpp b/indra/newview/llpanelhome.cpp
index b03bab31272a8cd5dfca70e90f21b8fd79c03a4e..ab0ccffae49004807417e601a1840ff78ec416c9 100755
--- a/indra/newview/llpanelhome.cpp
+++ b/indra/newview/llpanelhome.cpp
@@ -31,7 +31,7 @@
 #include "llmediactrl.h"
 #include "llviewerhome.h"
 
-static LLRegisterPanelClassWrapper<LLPanelHome> t_home("panel_sidetray_home");
+static LLPanelInjector<LLPanelHome> t_home("panel_sidetray_home");
 
 LLPanelHome::LLPanelHome() :
 	LLPanel(),
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 5c9b968ac908e3c5b19b0c8af053df0d6b60e712..934f8ed8c751a8d129cd3b8372f634b5821c2b9d 100755
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -53,7 +53,7 @@ typedef std::pair<LLUUID, std::string> folder_pair_t;
 static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right);
 static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats);
 
-static LLRegisterPanelClassWrapper<LLPanelLandmarkInfo> t_landmark_info("panel_landmark_info");
+static LLPanelInjector<LLPanelLandmarkInfo> t_landmark_info("panel_landmark_info");
 
 // Statics for textures filenames
 static std::string icon_pg;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 1ff0bfd09136e117774138a508ba1dc52865de1d..68c22c12fd1ee838fcb01d9dd19fc733e5870b8c 100755
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -58,7 +58,7 @@
 
 const std::string FILTERS_FILENAME("filters.xml");
 
-static LLRegisterPanelClassWrapper<LLPanelMainInventory> t_inventory("panel_main_inventory");
+static LLPanelInjector<LLPanelMainInventory> t_inventory("panel_main_inventory");
 
 void on_file_loaded_for_save(BOOL success, 
 							 LLViewerFetchedTexture *src_vi,
@@ -574,13 +574,16 @@ void LLPanelMainInventory::draw()
 
 void LLPanelMainInventory::updateItemcountText()
 {
-	// *TODO: Calling setlocale() on each frame may be inefficient.
-	//LLLocale locale(LLStringUtil::getLocale());
-	std::string item_count_string;
-	LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
+	if(mItemCount != gInventory.getItemCount())
+	{
+		mItemCount = gInventory.getItemCount();
+		mItemCountString = "";
+		LLLocale locale(LLLocale::USER_LOCALE);
+		LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
+	}
 
 	LLStringUtil::format_map_t string_args;
-	string_args["[ITEM_COUNT]"] = item_count_string;
+	string_args["[ITEM_COUNT]"] = mItemCountString;
 	string_args["[FILTER]"] = getFilterText();
 
 	std::string text = "";
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index fc8cc67c338dab0d47bf2b6c14f3670340f816d1..21f0ca0caeb47215effcd22555898d79b71c0e8e 100755
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -131,6 +131,8 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
 	LLSaveFolderState*			mSavedFolderState;
 	std::string					mFilterText;
 	std::string					mFilterSubString;
+	S32							mItemCount;
+	std::string 				mItemCountString;
 
 
 	//////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index dcecce6fe427725e64c552514f07050a0185fd96..79e079f6bdfb95f2b1a776eb480d651c4f6eff4a 100755
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -38,7 +38,7 @@
 #include "llviewercontrol.h"
 
 
-static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
+static LLPanelInjector<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
 
 const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams() 
 { 
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index a9af56f750b12a9bfbe43d876268136fbe44281d..7a408e736f53e0e1040fe57cf70e0d38e6072d38 100755
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -48,7 +48,7 @@
 #include "lltabcontainer.h"
 #include "lltexturectrl.h"
 
-static LLRegisterPanelClassWrapper<LLPanelMe> t_panel_me_profile("panel_me");
+static LLPanelInjector<LLPanelMe> t_panel_me_profile("panel_me");
 
 LLPanelMe::LLPanelMe(void) 
  : LLPanelProfile()
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index c09d4393c81c79e3f9f2a5a8e9fd9fc2e0c7d92b..f75d76da94dbcd91d47fec0ab6c8e4df01a4f228 100755
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -74,7 +74,7 @@
 #include "llwearabletype.h"
 #include "llweb.h"
 
-static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
+static LLPanelInjector<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
 
 const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
 const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index f90236f6f2890ac53dc1c9677f610063980cacbc..e0132d20fbf11915da8aad689499e615a5cc9da9 100755
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -46,7 +46,7 @@
 static const std::string OUTFITS_TAB_NAME = "outfitslist_tab";
 static const std::string COF_TAB_NAME = "cof_tab";
 
-static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
+static LLPanelInjector<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
 
 LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
 	mMyOutfitsPanel(NULL),
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index f551fc96eed45eb26e32bd38619887de1734ca37..f5542ee7a6cd38f1a5ebc2cbd6d088b0d8d3f22e 100755
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -216,7 +216,7 @@ static const LLAvatarItemStatusComparator STATUS_COMPARATOR;
 static LLAvatarItemDistanceComparator DISTANCE_COMPARATOR;
 static const LLAvatarItemRecentSpeakerComparator RECENT_SPEAKER_COMPARATOR;
 
-static LLRegisterPanelClassWrapper<LLPanelPeople> t_people("panel_people");
+static LLPanelInjector<LLPanelPeople> t_people("panel_people");
 
 //=============================================================================
 
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index cfbc8f1a94de31af71f925184fb24c8ac0dd78e1..f0617266dbd6ffd9fddc8694f635c5f6faec8e8d 100755
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -69,7 +69,7 @@ static const std::string CLASSIFIED_ID("classified_id");
 static const std::string CLASSIFIED_NAME("classified_name");
 
 
-static LLRegisterPanelClassWrapper<LLPanelPicks> t_panel_picks("panel_picks");
+static LLPanelInjector<LLPanelPicks> t_panel_picks("panel_picks");
 
 
 class LLPickHandler : public LLCommandHandler,
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 5d9971c16c14ad562dc7a8e9aaa32b42bbf453c0..14b5d9af47c435a8326ef2be09b7093991842d1b 100755
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -53,7 +53,7 @@
 #include "llviewerparcelmgr.h"
 #include "llviewerregion.h"
 
-static LLRegisterPanelClassWrapper<LLPanelPlaceProfile> t_place_profile("panel_place_profile");
+static LLPanelInjector<LLPanelPlaceProfile> t_place_profile("panel_place_profile");
 
 // Statics for textures filenames
 static std::string icon_pg;
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 8bb3ace2d9f1af8e3943f61e7ac9a3a9f3ccc68d..499b9ab62e15db1be86679f2c1eca3f6595acc1e 100755
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -229,7 +229,7 @@ class LLPlacesRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver
 };
 
 
-static LLRegisterPanelClassWrapper<LLPanelPlaces> t_places("panel_places");
+static LLPanelInjector<LLPanelPlaces> t_places("panel_places");
 
 LLPanelPlaces::LLPanelPlaces()
 	:	LLPanel(),
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index 381c11348d58084db53d1914060313dc1b020493..47e46a968f84b94ddd07e797d7986687571fb3c9 100755
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -60,7 +60,7 @@ class LLPanelSnapshotInventory
 	void onSend();
 };
 
-static LLRegisterPanelClassWrapper<LLPanelSnapshotInventory> panel_class("llpanelsnapshotinventory");
+static LLPanelInjector<LLPanelSnapshotInventory> panel_class("llpanelsnapshotinventory");
 
 LLPanelSnapshotInventory::LLPanelSnapshotInventory()
 {
diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp
index d153ff598d0f16820a94fc0a1920f16af4c0c595..43e38b95e25c4004b781d16b57d65db8641713b9 100755
--- a/indra/newview/llpanelsnapshotlocal.cpp
+++ b/indra/newview/llpanelsnapshotlocal.cpp
@@ -63,7 +63,7 @@ class LLPanelSnapshotLocal
 	void onSaveFlyoutCommit(LLUICtrl* ctrl);
 };
 
-static LLRegisterPanelClassWrapper<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
+static LLPanelInjector<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
 
 LLPanelSnapshotLocal::LLPanelSnapshotLocal()
 {
diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp
index 554fabe5b3d38f0cd9dded22f1b071b327c9e7cb..455c1c9e5fa08264d209c9ab3cea7afdcdab93d0 100755
--- a/indra/newview/llpanelsnapshotoptions.cpp
+++ b/indra/newview/llpanelsnapshotoptions.cpp
@@ -56,7 +56,7 @@ class LLPanelSnapshotOptions
 	void onSaveToComputer();
 };
 
-static LLRegisterPanelClassWrapper<LLPanelSnapshotOptions> panel_class("llpanelsnapshotoptions");
+static LLPanelInjector<LLPanelSnapshotOptions> panel_class("llpanelsnapshotoptions");
 
 LLPanelSnapshotOptions::LLPanelSnapshotOptions()
 {
diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp
index f2bb8f530bacde41a115b58965d7b304cfb21458..aa109e9a512fffb936a3fec90625a20f8437cb63 100755
--- a/indra/newview/llpanelsnapshotpostcard.cpp
+++ b/indra/newview/llpanelsnapshotpostcard.cpp
@@ -79,7 +79,7 @@ class LLPanelSnapshotPostcard
 	std::string mAgentEmail;
 };
 
-static LLRegisterPanelClassWrapper<LLPanelSnapshotPostcard> panel_class("llpanelsnapshotpostcard");
+static LLPanelInjector<LLPanelSnapshotPostcard> panel_class("llpanelsnapshotpostcard");
 
 LLPanelSnapshotPostcard::LLPanelSnapshotPostcard()
 :	mHasFirstMsgFocus(false)
diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp
index a7063183692ba9aebe9fbebec93c6f9b92c8786e..8949eb73ebafe3cb5c29fdc639b0773090f4a3d5 100755
--- a/indra/newview/llpanelsnapshotprofile.cpp
+++ b/indra/newview/llpanelsnapshotprofile.cpp
@@ -64,7 +64,7 @@ class LLPanelSnapshotProfile
 	void onSend();
 };
 
-static LLRegisterPanelClassWrapper<LLPanelSnapshotProfile> panel_class("llpanelsnapshotprofile");
+static LLPanelInjector<LLPanelSnapshotProfile> panel_class("llpanelsnapshotprofile");
 
 LLPanelSnapshotProfile::LLPanelSnapshotProfile()
 {
diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp
index 6be2ea6481cc0fa5e8563173fe23c6307c214f79..6f0a1624a793c5312a8f39ad32c10617883f494a 100755
--- a/indra/newview/llpanelvoicedevicesettings.cpp
+++ b/indra/newview/llpanelvoicedevicesettings.cpp
@@ -40,7 +40,7 @@
 #include "lluictrlfactory.h"
 
 
-static LLRegisterPanelClassWrapper<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
+static LLPanelInjector<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
 static const std::string DEFAULT_DEVICE("Default");
 
 
diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp
index 5fec6d967d4d8978083b15e615d19053e43482c9..7da553801a1ea4d05930b6d797dbf62fc6713d07 100755
--- a/indra/newview/llpanelvoiceeffect.cpp
+++ b/indra/newview/llpanelvoiceeffect.cpp
@@ -36,7 +36,7 @@
 #include "lltransientfloatermgr.h"
 #include "llvoiceclient.h"
 
-static LLRegisterPanelClassWrapper<LLPanelVoiceEffect> t_panel_voice_effect("panel_voice_effect");
+static LLPanelInjector<LLPanelVoiceEffect> t_panel_voice_effect("panel_voice_effect");
 
 LLPanelVoiceEffect::LLPanelVoiceEffect()
 	: mVoiceEffectCombo(NULL)
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index aa3ed22bee8b7b089e559e9187c0f0391a5da882..edb624e3aad90df8319fd163b3dff2d6a2538718 100755
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -151,7 +151,7 @@ class LLWearingContextMenu : public LLListContextMenu
 
 std::string LLPanelAppearanceTab::sFilterSubString = LLStringUtil::null;
 
-static LLRegisterPanelClassWrapper<LLPanelWearing> t_panel_wearing("panel_wearing");
+static LLPanelInjector<LLPanelWearing> t_panel_wearing("panel_wearing");
 
 LLPanelWearing::LLPanelWearing()
 	:	LLPanelAppearanceTab()
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index 08829c11840d5fd5b57cdfb2efb1a78048ab90ea..153f0930c27ab5ee3b9af6545e9f8ce1fb4307ca 100755
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -27,7 +27,7 @@
 
 #include "llpopupview.h"
 
-static LLRegisterPanelClassWrapper<LLPopupView> r("popup_holder");
+static LLPanelInjector<LLPopupView> r("popup_holder");
 
 bool view_visible_and_enabled(LLView* viewp)
 {
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index 989f0b0e6056a4cc7448a1f73d10dc74cdc732cc..1257ee7f9492870b42f2afca006f28d7c11b02ff 100755
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -59,7 +59,7 @@ S32 gStartImageWidth = 1;
 S32 gStartImageHeight = 1;
 const F32 FADE_TO_WORLD_TIME = 1.0f;
 
-static LLRegisterPanelClassWrapper<LLProgressView> r("progress_view");
+static LLPanelInjector<LLProgressView> r("progress_view");
 
 // XUI: Translate
 LLProgressView::LLProgressView() 
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 7b397d46f31d501393dd497be626cac5b3b2f20c..c83b459279c5d04ae2ceb03ba76ea9f2982a8254 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -6187,8 +6187,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
 
 	if (shader)
-	{ //switch to "solid color" program for SH-2690 -- works around driver bug causing bad triangles when rendering silhouettes
-		gSolidColorProgram.bind();
+	{ //use UI program for selection highlights (texture color modulated by vertex color)
+		gUIProgram.bind();
 	}
 
 	gGL.matrixMode(LLRender::MM_MODELVIEW);
@@ -6243,10 +6243,11 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 			gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 			gGL.begin(LLRender::LINES);
 			{
+				gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+
 				for(S32 i = 0; i < mSilhouetteVertices.size(); i += 2)
 				{
 					u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
-					gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
 					gGL.texCoord2f( u_coord, v_coord );
 					gGL.vertex3fv( mSilhouetteVertices[i].mV);
 					u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index df413ab849aee3ebc3e3f713da1e3b51170ca3e6..ec6a1d9bdc156e77231f29d1a89bed30767a547d 100755
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -49,7 +49,7 @@
 #include "llvoavatarself.h"
 #include "llviewerwearable.h"
 
-static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
+static LLPanelInjector<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
 
 class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
 {
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index cbf43dbb937c522f51eaf32ee6712262b8188bea..2e91ceee2ee8faea863fc3dcd43b4ae0e8566ddf 100755
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -59,7 +59,7 @@
 #include "llviewernetwork.h"
 #include "llweb.h"
 
-static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_inventory");
+static LLPanelInjector<LLSidepanelInventory> t_inventory("sidepanel_inventory");
 
 //
 // Constants
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index 92c2863ffdf49124f54c38ee7b28f74412e7e8ac..e52b2f25597f0a45ff682c5e19bb78d6560aa826 100755
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -127,7 +127,7 @@ void LLObjectInventoryObserver::inventoryChanged(LLViewerObject* object,
 /// Class LLSidepanelItemInfo
 ///----------------------------------------------------------------------------
 
-static LLRegisterPanelClassWrapper<LLSidepanelItemInfo> t_item_info("sidepanel_item_info");
+static LLPanelInjector<LLSidepanelItemInfo> t_item_info("sidepanel_item_info");
 
 // Default constructor
 LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p)
diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp
index 9be6d0c5f1a8242920dba7885f1731eebf5e8eaa..44280989297e61addbc1678ec835bf914f09bc9a 100755
--- a/indra/newview/llsidepaneltaskinfo.cpp
+++ b/indra/newview/llsidepaneltaskinfo.cpp
@@ -71,7 +71,7 @@
 
 LLSidepanelTaskInfo* LLSidepanelTaskInfo::sActivePanel = NULL;
 
-static LLRegisterPanelClassWrapper<LLSidepanelTaskInfo> t_task_info("sidepanel_task_info");
+static LLPanelInjector<LLSidepanelTaskInfo> t_task_info("sidepanel_task_info");
 
 // Default constructor
 LLSidepanelTaskInfo::LLSidepanelTaskInfo()
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 67a76460a71fcd0e6be3497946bc81c08ca31c76..d5f8a1e46ea1a2fde693107de2c7f55178db46f0 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -786,14 +786,18 @@ bool idle_startup()
 			display_startup();
 			LLPanelLogin::giveFocus();
 
-			if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+			// MAINT-3231 Show first run dialog only for Desura viewer
+			if (gSavedSettings.getString("sourceid") == "1208_desura")
 			{
-				LL_INFOS("AppInit") << "FirstLoginThisInstall, calling show_first_run_dialog()" << LL_ENDL;
-				show_first_run_dialog();
-			}
-			else
-			{
-				LL_DEBUGS("AppInit") << "FirstLoginThisInstall off" << LL_ENDL;
+				if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
+				{
+					LL_INFOS("AppInit") << "FirstLoginThisInstall, calling show_first_run_dialog()" << LL_ENDL;
+					show_first_run_dialog();
+				}
+				else
+				{
+					LL_DEBUGS("AppInit") << "FirstLoginThisInstall off" << LL_ENDL;
+				}
 			}
 
 			LLStartUp::setStartupState( STATE_LOGIN_WAIT );		// Wait for user input
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 4300cafb6bae86c5b7c37923ea7c0b7b8f9b5ec1..ea837c9127aae33ec88d345f33984a9410b1f663 100755
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -820,7 +820,7 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
 			{
 				mNoCopyTextureSelected = TRUE;
 			}
-			mImageAssetID = itemp->getAssetUUID();
+			setImageID(itemp->getAssetUUID());
 			mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
 			if (user_action && mCanPreview)
 			{
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 3a41bf28b4710fca52a56459b9cb9059f22db4e5..9824f2dd38c0d3476413882e0305bfa926160370 100755
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -41,6 +41,7 @@
 #include "llnotificationsutil.h"
 #include "llviewermessage.h"
 #include "llfloaterimsession.h"
+#include "llavataractions.h"
 
 const S32 BOTTOM_PAD = VPAD * 3;
 const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding
@@ -130,6 +131,7 @@ LLToastNotifyPanel::~LLToastNotifyPanel()
 	mButtonClickConnection.disconnect();
 
 	std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer());
+	mBtnCallbackData.clear();
 	if (mIsTip)
 		{
 			LLNotifications::getInstance()->cancel(mNotification);
@@ -313,6 +315,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
     mTextBox->setVisible(TRUE);
     mTextBox->setPlainText(!show_images);
     mTextBox->setValue(mNotification->getMessage());
+	mTextBox->setIsFriendCallback(LLAvatarActions::isFriend);
 
     // add buttons for a script notification
     if (mIsTip)
diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h
index ecc435d84413e9373b27f16e9c0ca0c4c6753d65..c5bad9d53272635821f71587dfe9764290faeebb 100755
--- a/indra/newview/lltool.h
+++ b/indra/newview/lltool.h
@@ -39,7 +39,7 @@ class LLView;
 class LLPanel;
 
 class LLTool
-:	public LLMouseHandler
+:	public LLMouseHandler, public LLThreadSafeRefCount
 {
 public:
 	LLTool( const std::string& name, LLToolComposite* composite = NULL );
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 78a555d67d3526083c6747d69af3710fbe794b45..36d4654393482a44f4ffde13f90529f158bbe559 100755
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -77,7 +77,7 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
 	mToolbarsLoaded(false),
 	mBottomToolbarPanel(NULL)
 {
-	for (S32 i = 0; i < TOOLBAR_COUNT; i++)
+	for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; i++)
 	{
 		mToolbars[i] = NULL;
 	}
@@ -96,12 +96,18 @@ LLToolBarView::~LLToolBarView()
 
 BOOL LLToolBarView::postBuild()
 {
-	mToolbars[TOOLBAR_LEFT]   = getChild<LLToolBar>("toolbar_left");
-	mToolbars[TOOLBAR_RIGHT]  = getChild<LLToolBar>("toolbar_right");
-	mToolbars[TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
+	mToolbars[LLToolBarEnums::TOOLBAR_LEFT] = getChild<LLToolBar>("toolbar_left");
+	mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_LEFT);
+
+	mToolbars[LLToolBarEnums::TOOLBAR_RIGHT] = getChild<LLToolBar>("toolbar_right");
+	mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_RIGHT);
+
+	mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
+	mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCenterLayoutPanel()->setLocationId(LLToolBarEnums::TOOLBAR_BOTTOM);
+
 	mBottomToolbarPanel = getChild<LLView>("bottom_toolbar_panel");
 
-	for (int i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	for (int i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 	{
 		mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
 		mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
@@ -115,9 +121,9 @@ BOOL LLToolBarView::postBuild()
 
 S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const
 {
-	S32 command_location = TOOLBAR_NONE;
+	S32 command_location = LLToolBarEnums::TOOLBAR_NONE;
 
-	for (S32 loc = TOOLBAR_FIRST; loc <= TOOLBAR_LAST; loc++)
+	for (S32 loc = LLToolBarEnums::TOOLBAR_FIRST; loc <= LLToolBarEnums::TOOLBAR_LAST; loc++)
 	{
 		if (mToolbars[loc]->hasCommand(commandId))
 		{
@@ -129,7 +135,7 @@ S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const
 	return command_location;
 }
 
-S32 LLToolBarView::addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank)
+S32 LLToolBarView::addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank)
 {
 	int old_rank;
 	removeCommand(commandId, old_rank);
@@ -144,7 +150,7 @@ S32 LLToolBarView::removeCommand(const LLCommandId& commandId, int& rank)
 	S32 command_location = hasCommand(commandId);
 	rank = LLToolBar::RANK_NONE;
 
-	if (command_location != TOOLBAR_NONE)
+	if (command_location != LLToolBarEnums::TOOLBAR_NONE)
 	{
 		rank = mToolbars[command_location]->removeCommand(commandId);
 	}
@@ -156,7 +162,7 @@ S32 LLToolBarView::enableCommand(const LLCommandId& commandId, bool enabled)
 {
 	S32 command_location = hasCommand(commandId);
 
-	if (command_location != TOOLBAR_NONE)
+	if (command_location != LLToolBarEnums::TOOLBAR_NONE)
 	{
 		mToolbars[command_location]->enableCommand(commandId, enabled);
 	}
@@ -168,7 +174,7 @@ S32 LLToolBarView::stopCommandInProgress(const LLCommandId& commandId)
 {
 	S32 command_location = hasCommand(commandId);
 
-	if (command_location != TOOLBAR_NONE)
+	if (command_location != LLToolBarEnums::TOOLBAR_NONE)
 	{
 		mToolbars[command_location]->stopCommandInProgress(commandId);
 	}
@@ -180,7 +186,7 @@ S32 LLToolBarView::flashCommand(const LLCommandId& commandId, bool flash, bool f
 {
 	S32 command_location = hasCommand(commandId);
 
-	if (command_location != TOOLBAR_NONE)
+	if (command_location != LLToolBarEnums::TOOLBAR_NONE)
 	{
 		mToolbars[command_location]->flashCommand(commandId, flash, force_flashing);
 	}
@@ -259,7 +265,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
 	}
 	
 	// Clear the toolbars now before adding the loaded commands and settings
-	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 	{
 		if (mToolbars[i])
 		{
@@ -268,46 +274,46 @@ bool LLToolBarView::loadToolbars(bool force_default)
 	}
 	
 	// Add commands to each toolbar
-	if (toolbar_set.left_toolbar.isProvided() && mToolbars[TOOLBAR_LEFT])
+	if (toolbar_set.left_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
 	{
 		if (toolbar_set.left_toolbar.button_display_mode.isProvided())
 		{
 			LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode;
-			mToolbars[TOOLBAR_LEFT]->setButtonType(button_type);
+			mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setButtonType(button_type);
 		}
 		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.left_toolbar.commands)
 		{
-			if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_LEFT]))
+			if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT]))
 			{
 				llwarns << "Error adding command '" << command_params.name() << "' to left toolbar." << llendl;
 			}
 		}
 	}
-	if (toolbar_set.right_toolbar.isProvided() && mToolbars[TOOLBAR_RIGHT])
+	if (toolbar_set.right_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
 	{
 		if (toolbar_set.right_toolbar.button_display_mode.isProvided())
 		{
 			LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode;
-			mToolbars[TOOLBAR_RIGHT]->setButtonType(button_type);
+			mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->setButtonType(button_type);
 		}
 		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.right_toolbar.commands)
 		{
-			if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_RIGHT]))
+			if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]))
 			{
 				llwarns << "Error adding command '" << command_params.name() << "' to right toolbar." << llendl;
 			}
 		}
 	}
-	if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[TOOLBAR_BOTTOM])
+	if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
 	{
 		if (toolbar_set.bottom_toolbar.button_display_mode.isProvided())
 		{
 			LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode;
-			mToolbars[TOOLBAR_BOTTOM]->setButtonType(button_type);
+			mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->setButtonType(button_type);
 		}
 		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.bottom_toolbar.commands)
 		{
-			if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_BOTTOM]))
+			if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]))
 			{
 				llwarns << "Error adding command '" << command_params.name() << "' to bottom toolbar." << llendl;
 			}
@@ -319,7 +325,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
 
 bool LLToolBarView::clearToolbars()
 {
-	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 	{
 		if (mToolbars[i])
 		{
@@ -371,20 +377,20 @@ void LLToolBarView::saveToolbars() const
 	
 	// Build the parameter tree from the toolbar data
 	LLToolBarView::ToolbarSet toolbar_set;
-	if (mToolbars[TOOLBAR_LEFT])
+	if (mToolbars[LLToolBarEnums::TOOLBAR_LEFT])
 	{
-		toolbar_set.left_toolbar.button_display_mode = mToolbars[TOOLBAR_LEFT]->getButtonType();
-		addToToolset(mToolbars[TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
+		toolbar_set.left_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getButtonType();
+		addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
 	}
-	if (mToolbars[TOOLBAR_RIGHT])
+	if (mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])
 	{
-		toolbar_set.right_toolbar.button_display_mode = mToolbars[TOOLBAR_RIGHT]->getButtonType();
-		addToToolset(mToolbars[TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
+		toolbar_set.right_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getButtonType();
+		addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
 	}
-	if (mToolbars[TOOLBAR_BOTTOM])
+	if (mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])
 	{
-		toolbar_set.bottom_toolbar.button_display_mode = mToolbars[TOOLBAR_BOTTOM]->getButtonType();
-		addToToolset(mToolbars[TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
+		toolbar_set.bottom_toolbar.button_display_mode = mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getButtonType();
+		addToToolset(mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
 	}
 	
 	// Serialize the parameter tree
@@ -511,9 +517,9 @@ void LLToolBarView::onToolBarButtonRemoved(LLView* button)
 
 void LLToolBarView::draw()
 {
-	LLRect toolbar_rects[TOOLBAR_COUNT];
+	LLRect toolbar_rects[LLToolBarEnums::TOOLBAR_COUNT];
 	
-	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 	{
 		if (mToolbars[i])
 		{
@@ -532,7 +538,7 @@ void LLToolBarView::draw()
 		}
 	}
 	
-	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 	{
 		mToolbars[i]->getParent()->setVisible(mShowToolbars 
 											&& (mToolbars[i]->hasButtons() 
@@ -544,7 +550,7 @@ void LLToolBarView::draw()
 	{
 		LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
 
-		for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+		for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 		{
 			gl_rect_2d(toolbar_rects[i], drop_color, TRUE);
 		}
@@ -620,7 +626,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
 			S32 old_toolbar_loc = gToolBarView->hasCommand(command_id);
 			LLToolBar* old_toolbar = NULL;
 
-			if (old_toolbar_loc != TOOLBAR_NONE)
+			if (old_toolbar_loc != LLToolBarEnums::TOOLBAR_NONE)
 			{
 				llassert(gToolBarView->mDragToolbarButton);
 				old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
@@ -683,7 +689,7 @@ bool LLToolBarView::isModified() const
 {
 	bool modified = false;
 
-	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
 	{
 		modified |= mToolbars[i]->isModified();
 	}
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index dcc38620746b70cc0c022fbb041bc73e8bea3cc3..a230c2fdee7f78ce93509ac192069f85f97ff54f 100755
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -40,19 +40,6 @@ class LLUICtrlFactory;
 class LLToolBarView : public LLUICtrl
 {
 public:
-	typedef enum
-	{
-		TOOLBAR_NONE = 0,
-		TOOLBAR_LEFT,
-		TOOLBAR_RIGHT,
-		TOOLBAR_BOTTOM,
-
-		TOOLBAR_COUNT,
-
-		TOOLBAR_FIRST = TOOLBAR_LEFT,
-		TOOLBAR_LAST = TOOLBAR_BOTTOM,
-	} EToolBarLocation;
-
 	// Xui structure of the toolbar panel
 	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {};
 
@@ -84,9 +71,9 @@ class LLToolBarView : public LLUICtrl
 	virtual void draw();
 
 	// Toolbar view interface with the rest of the world
-	// Checks if the commandId is being used somewhere in one of the toolbars, returns EToolBarLocation
+	// Checks if the commandId is being used somewhere in one of the toolbars, returns LLToolBarEnums::EToolBarLocation
 	S32 hasCommand(const LLCommandId& commandId) const;
-	S32 addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
+	S32 addCommand(const LLCommandId& commandId, LLToolBarEnums::EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
 	S32 removeCommand(const LLCommandId& commandId, int& rank);	// Sets the rank the removed command was at, RANK_NONE if not found
 	S32 enableCommand(const LLCommandId& commandId, bool enabled);
 	S32 stopCommandInProgress(const LLCommandId& commandId);
@@ -109,7 +96,7 @@ class LLToolBarView : public LLUICtrl
 	static void resetDragTool(LLToolBarButton* toolbarButton);
 	LLInventoryObject* getDragItem();
 	LLView* getBottomToolbar() { return mBottomToolbarPanel; }
-	LLToolBar* getToolbar(EToolBarLocation toolbar) { return mToolbars[toolbar]; }
+	LLToolBar* getToolbar(LLToolBarEnums::EToolBarLocation toolbar) { return mToolbars[toolbar]; }
 	bool isModified() const;
 	
 protected:
@@ -127,7 +114,7 @@ class LLToolBarView : public LLUICtrl
 	static void onToolBarButtonRemoved(LLView* button);
 
 	// Pointers to the toolbars handled by the toolbar view
-	LLToolBar*  mToolbars[TOOLBAR_COUNT];
+	LLToolBar*  mToolbars[LLToolBarEnums::TOOLBAR_COUNT];
 	bool		mToolbarsLoaded;
 	
 	bool				mDragStarted;
diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp
index 5270c3d33ff12f83dca2d1d0a9b449225fab4aa1..b75d6b3dcbdb0d85f446b22ae74964bbc3f2078e 100755
--- a/indra/newview/lltoolcomp.cpp
+++ b/indra/newview/lltoolcomp.cpp
@@ -61,7 +61,7 @@ extern LLControlGroup gSavedSettings;
 
 
 // we use this in various places instead of NULL
-static LLTool* sNullTool = new LLTool(std::string("null"), NULL); 
+static LLPointer<LLTool> sNullTool(new LLTool(std::string("null"), NULL)); 
 
 //-----------------------------------------------------------------------
 // LLToolComposite
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 00b15a5f26e0f4c7f2e0a8cf5857b5b30602a21f..0c34db39b58e22107b76e6c2e78b322c26ed30e9 100755
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -307,7 +307,7 @@ bool LLURLDispatcher::dispatchRightClick(const std::string& slurl)
 }
 
 // static
-bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
+bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl, bool trusted_content)
 {
 	// *NOTE: Text editors are considered sources of trusted URLs
 	// in order to make avatar profile links in chat history work.
@@ -315,9 +315,9 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
 	// receiving resident will see it and must affirmatively
 	// click on it.
 	// *TODO: Make this trust model more refined.  JC
-	const bool trusted_browser = true;
+
 	LLMediaCtrl* web = NULL;
-	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), "clicked", web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), "clicked", web, trusted_content);
 }
 
 
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index 6309a97af532dd4e63e283d34ed6471f2d901286..9b05260af11e5d9a9676937fe6111b965078cb1b 100755
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -53,7 +53,7 @@ class LLURLDispatcher
 
 	static bool dispatchRightClick(const std::string& slurl);
 
-	static bool dispatchFromTextEditor(const std::string& slurl);
+	static bool dispatchFromTextEditor(const std::string& slurl, bool trusted_content);
 };
 
 #endif
diff --git a/indra/newview/llurldispatcherlistener.cpp b/indra/newview/llurldispatcherlistener.cpp
index c7b9afafefc2286fc61b99a89ef53c3ee9290c80..7545f3a9b3bd72b4e1a3a1affba6b3241496c894 100755
--- a/indra/newview/llurldispatcherlistener.cpp
+++ b/indra/newview/llurldispatcherlistener.cpp
@@ -71,5 +71,5 @@ void LLURLDispatcherListener::dispatchRightClick(const LLSD& params) const
 
 void LLURLDispatcherListener::dispatchFromTextEditor(const LLSD& params) const
 {
-    LLURLDispatcher::dispatchFromTextEditor(params["url"]);
+	LLURLDispatcher::dispatchFromTextEditor(params["url"], false);
 }
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index fb07ab8fbec00aaa143f534109ab3b41c2b8f518..c7c8da27f3ff9b9549005cbf01be39b24180ef1c 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7197,6 +7197,17 @@ class LLAdvancedClickRenderProfile: public view_listener_t
 	}
 };
 
+void gpu_benchmark();
+
+class LLAdvancedClickRenderBenchmark: public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		gpu_benchmark();
+		return true;
+	}
+};
+
 void menu_toggle_attached_lights(void* user_data)
 {
 	LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
@@ -7806,6 +7817,22 @@ void handle_show_url(const LLSD& param)
 
 }
 
+void handle_report_bug(const LLSD& param)
+{
+	LLUIString url(param.asString());
+	
+	LLStringUtil::format_map_t replace;
+	replace["[ENVIRONMENT]"] = LLURI::escape(LLAppViewer::instance()->getViewerInfoString());
+	LLSLURL location_url;
+	LLAgentUI::buildSLURL(location_url);
+	replace["[LOCATION]"] = location_url.getSLURLString();
+
+	LLUIString file_bug_url = gSavedSettings.getString("ReportBugURL");
+	file_bug_url.setArgs(replace);
+
+	LLWeb::loadURLExternal(file_bug_url.getString());
+}
+
 void handle_buy_currency_test(void*)
 {
 	std::string url =
@@ -8637,6 +8664,7 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedCheckRenderShadowOption(), "Advanced.CheckRenderShadowOption");
 	view_listener_t::addMenu(new LLAdvancedClickRenderShadowOption(), "Advanced.ClickRenderShadowOption");
 	view_listener_t::addMenu(new LLAdvancedClickRenderProfile(), "Advanced.ClickRenderProfile");
+	view_listener_t::addMenu(new LLAdvancedClickRenderBenchmark(), "Advanced.ClickRenderBenchmark");
 
 	#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
 	view_listener_t::addMenu(new LLAdvancedHandleToggleHackedGodmode(), "Advanced.HandleToggleHackedGodmode");
@@ -8652,6 +8680,7 @@ void initialize_menus()
 	commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test,	_2));	// sigh! this one opens the MEDIA browser
 	commit.add("Advanced.WebContentTest", boost::bind(&handle_web_content_test, _2));	// this one opens the Web Content floater
 	commit.add("Advanced.ShowURL", boost::bind(&handle_show_url, _2));
+	commit.add("Advanced.ReportBug", boost::bind(&handle_report_bug, _2));
 	view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest");
 	view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr");
 	view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory");
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 267aa9532c3ab5c07cc92efadd4e64ebdd836828..df5c7d5c2e885a48a35baca92def103bd390d263 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2409,14 +2409,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 					&& from_id.notNull() //not a system message
 					&& to_id.notNull()) //not global message
 		{
-			// return a standard "do not disturb" message, but only do it to online IM 
+			// return a standard "do not disturb" message, but only do it to online IM
 			// (i.e. not other auto responses and not store-and-forward IM)
-			if (!gIMMgr->hasSession(session_id))
-			{
-				// if there is not a panel for this conversation (i.e. it is a new IM conversation
-				// initiated by the other party) then...
-				send_do_not_disturb_message(msg, from_id, session_id);
-			}
+
+			send_do_not_disturb_message(msg, from_id, session_id);
 
 			// now store incoming IM in chat history
 
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 1544e66431a9df31e911d66bd40fa820195db038..e62998db70706a2b9fca39f5051ef9ed3dde7c1d 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -236,7 +236,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mOnMap(FALSE),
 	mStatic(FALSE),
 	mNumFaces(0),
-	mTimeDilation(1.f),
 	mRotTime(0.f),
 	mAngularVelocityRot(),
 	mPreviousRotation(),
@@ -943,7 +942,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 	U16 time_dilation16;
 	mesgsys->getU16Fast(_PREHASH_RegionData, _PREHASH_TimeDilation, time_dilation16);
 	F32 time_dilation = ((F32) time_dilation16) / 65535.f;
-	mTimeDilation = time_dilation;
 	mRegionp->setTimeDilation(time_dilation);
 
 	// this will be used to determine if we've really changed position
@@ -1986,7 +1984,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 		LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender());
 		if (cdp)
 		{
-			F32 ping_delay = 0.5f * mTimeDilation * ( ((F32)cdp->getPingDelay()) * 0.001f + gFrameDTClamped);
+			F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay()) * 0.001f + gFrameDTClamped);
 			LLVector3 diff = getVelocity() * ping_delay; 
 			new_pos_parent += diff;
 		}
@@ -2185,35 +2183,33 @@ BOOL LLViewerObject::isActive() const
 
 
 
-void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time)
 {
 	//static LLFastTimer::DeclareTimer ftm("Viewer Object");
 	//LLFastTimer t(ftm);
 
 	if (!mDead)
 	{
-	// CRO - don't velocity interp linked objects!
-	// Leviathan - but DO velocity interp joints
-	if (!mStatic && sVelocityInterpolate && !isSelected())
-	{
-		// calculate dt from last update
-		F32 dt_raw = (F32)(time - mLastInterpUpdateSecs);
-		F32 dt = mTimeDilation * dt_raw;
+		if (!mStatic && sVelocityInterpolate && !isSelected())
+		{
+			// calculate dt from last update
+			F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f;
+			F32 dt = time_dilation * (F32)(time - mLastInterpUpdateSecs);
 
 			applyAngularVelocity(dt);
 
 			if (isAttachment())
-				{
-					mLastInterpUpdateSecs = time;
+			{
+				mLastInterpUpdateSecs = time;
 				return;
+			}
+			else
+			{	// Move object based on it's velocity and rotation
+				interpolateLinearMotion(time, dt);
+			}
 		}
-		else
-		{	// Move object based on it's velocity and rotation
-			interpolateLinearMotion(time, dt);
-		}
-	}
 
-	updateDrawable(FALSE);
+		updateDrawable(FALSE);
 	}
 }
 
@@ -4063,7 +4059,7 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry)
 {
 	LLPrimitive::setTE(te, texture_entry);
 
-	const LLUUID& image_id = getTE(te)->getID();
+		const LLUUID& image_id = getTE(te)->getID();
 		mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
 	
 	if (getTE(te)->getMaterialParams().notNull())
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 80bdd628a13715beef292aaa62f0c2d2a3f656a4..c34d4493d53d7301febcf36dcc0cf406e7dbc8d5 100755
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -143,7 +143,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	LLNameValue*	getNVPair(const std::string& name) const;			// null if no name value pair by that name
 
 	// Object create and update functions
-	virtual void	idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	virtual void	idleUpdate(LLAgent &agent, const F64 &time);
 
 	// Types of media we can associate
 	enum { MEDIA_NONE = 0, MEDIA_SET = 1 };
@@ -305,7 +305,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	/*virtual*/ S32		setTETexture(const U8 te, const LLUUID &uuid);
 	/*virtual*/ S32		setTENormalMap(const U8 te, const LLUUID &uuid);
 	/*virtual*/ S32		setTESpecularMap(const U8 te, const LLUUID &uuid);
-	S32 setTETextureCore(const U8 te, LLViewerTexture *image);
+	S32 				setTETextureCore(const U8 te, LLViewerTexture *image);
 	S32 setTENormalMapCore(const U8 te, LLViewerTexture *image);
 	S32 setTESpecularMapCore(const U8 te, LLViewerTexture *image);
 	/*virtual*/ S32		setTEColor(const U8 te, const LLColor3 &color);
@@ -743,7 +743,6 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	BOOL			mStatic;					// Object doesn't move.
 	S32				mNumFaces;
 
-	F32				mTimeDilation;				// Time dilation sent with the object.
 	F32				mRotTime;					// Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
 	LLQuaternion	mAngularVelocityRot;		// accumulated rotation from the angular velocity computations
 	LLQuaternion	mPreviousRotation;
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index b4e287c446775197f2900e400f6b8e35f8d50df1..f667c2bf331aeefdea261e941723bd60ca3a90a9 100755
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -399,10 +399,10 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 
 			if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
 			{
-				compressed_dp.unpackUUID(fullid, "ID");
-				compressed_dp.unpackU32(local_id, "LocalID");
-				compressed_dp.unpackU8(pcode, "PCode");
-			}
+					compressed_dp.unpackUUID(fullid, "ID");
+					compressed_dp.unpackU32(local_id, "LocalID");
+					compressed_dp.unpackU8(pcode, "PCode");
+				}
 			else
 			{
 				compressed_dp.unpackU32(local_id, "LocalID");
@@ -561,7 +561,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated);
 		}
 		recorder.objectUpdateEvent(local_id, update_type, objectp, msg_size);
-		objectp->setLastUpdateType(update_type);
+		objectp->setLastUpdateType(update_type);		
 		objectp->setLastUpdateCached(bCached);
 	}
 
@@ -852,7 +852,7 @@ class LLPhysicsFlagsResponder : public LLCurl::Responder
 	LLSD mObjectIDs;
 };
 
-void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
+void LLViewerObjectList::update(LLAgent &agent)
 {
 	// Update globals
 	LLViewerObject::setVelocityInterpolate( gSavedSettings.getBOOL("VelocityInterpolate") );
@@ -942,7 +942,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 			objectp = *iter;
 			if (objectp->isAvatar())
 			{
-				objectp->idleUpdate(agent, world, frame_time);
+				objectp->idleUpdate(agent, frame_time);
 			}
 		}
 	}
@@ -953,7 +953,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 		{
 			objectp = *idle_iter;
 			llassert(objectp->isActive());
-			objectp->idleUpdate(agent, world, frame_time);
+			objectp->idleUpdate(agent, frame_time);
 		}
 
 		//update flexible objects
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 6518c25d09f773b171dce567da5f8d222883b715..98b50fa78902f3b1bd818e6a617ff9dbfdebcc9a 100755
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -83,7 +83,7 @@ class LLViewerObjectList
 	void processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
 	void processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
 	void updateApparentAngles(LLAgent &agent);
-	void update(LLAgent &agent, LLWorld &world);
+	void update(LLAgent &agent);
 
 	void fetchObjectCosts();
 	void fetchPhysicsFlags();
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index c6ae7d7fa070e58b4653abd8722758ee09e61e7e..a271690349ff30f516d71d4834de7a5494cef185 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -302,9 +302,14 @@ class BaseCapabilitiesCompleteTracker :  public LLHTTPClient::Responder
 		
 		if ( regionp->getRegionImpl()->mCapabilities.size() != regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() )
 		{
-			llinfos<<"BaseCapabilitiesCompleteTracker "<<"Sim sent duplicate seed caps that differs in size - most likely content."<<llendl;			
+			llinfos << "BaseCapabilitiesCompleteTracker " << "sim " << regionp->getName()
+				<< " sent duplicate seed caps that differs in size - most likely content. " 
+				<< (S32) regionp->getRegionImpl()->mCapabilities.size() << " vs " << regionp->getRegionImpl()->mSecondCapabilitiesTracker.size()
+				<< llendl;			
+			
 			//todo#add cap debug versus original check?
-			/*CapabilityMap::const_iterator iter = regionp->getRegionImpl()->mCapabilities.begin();
+			/*
+			CapabilityMap::const_iterator iter = regionp->getRegionImpl()->mCapabilities.begin();
 			while (iter!=regionp->getRegionImpl()->mCapabilities.end() )
 			{
 				llinfos << "BaseCapabilitiesCompleteTracker Original " << iter->first << " " << iter->second<<llendl;
@@ -395,6 +400,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
 	mImpl->mObjectPartition.push_back(new LLBridgePartition());	//PARTITION_BRIDGE
 	mImpl->mObjectPartition.push_back(new LLHUDParticlePartition());//PARTITION_HUD_PARTICLE
 	mImpl->mObjectPartition.push_back(NULL);						//PARTITION_NONE
+
+	mRenderInfoRequestTimer.resetWithExpiry(0.f);		// Set timer to be expired
+	setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer, _1));
 }
 
 
@@ -1579,6 +1587,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
 	capabilityNames.append("AgentState");
 	capabilityNames.append("AttachmentResources");
 	capabilityNames.append("AvatarPickerSearch");
+	capabilityNames.append("AvatarRenderInfo");
 	capabilityNames.append("CharacterProperties");
 	capabilityNames.append("ChatSessionRequest");
 	capabilityNames.append("CopyInventoryFromNotecard");
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 553f6a2d5993ad2b10986137ca7d7efebdf8bc8a..e88b22b4617bcf7f3c8412f8d4c83b5973698f9c 100755
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -87,6 +87,8 @@ LLGLSLShader	gClipProgram;
 LLGLSLShader	gDownsampleDepthProgram;
 LLGLSLShader	gDownsampleDepthRectProgram;
 LLGLSLShader	gAlphaMaskProgram;
+LLGLSLShader	gBenchmarkProgram;
+
 
 //object shaders
 LLGLSLShader		gObjectSimpleProgram;
@@ -681,6 +683,7 @@ void LLViewerShaderMgr::unloadShaders()
 	gClipProgram.unload();
 	gDownsampleDepthProgram.unload();
 	gDownsampleDepthRectProgram.unload();
+	gBenchmarkProgram.unload();
 	gAlphaMaskProgram.unload();
 	gUIProgram.unload();
 	gPathfindingProgram.unload();
@@ -3188,6 +3191,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
 		success = gDownsampleDepthProgram.createShader(NULL, NULL);
 	}
 
+	if (success)
+	{
+		gBenchmarkProgram.mName = "Benchmark Shader";
+		gBenchmarkProgram.mShaderFiles.clear();
+		gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER_ARB));
+		gBenchmarkProgram.mShaderFiles.push_back(make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gBenchmarkProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gBenchmarkProgram.createShader(NULL, NULL);
+	}
+
+	if (success)
+	{
+		gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader";
+		gDownsampleDepthRectProgram.mShaderFiles.clear();
+		gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB));
+		gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gDownsampleDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+		success = gDownsampleDepthRectProgram.createShader(NULL, NULL);
+	}
+
 	if (success)
 	{
 		gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader";
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 3d89f8d20a5326fbe9bead016eecc558fe205afa..53569ca7ab5e398f231b7ce9f10ec7cfd65e8356 100755
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -183,6 +183,7 @@ extern LLGLSLShader			gDebugProgram;
 extern LLGLSLShader			gClipProgram;
 extern LLGLSLShader			gDownsampleDepthProgram;
 extern LLGLSLShader			gDownsampleDepthRectProgram;
+extern LLGLSLShader			gBenchmarkProgram;
 
 //output tex0[tc0] + tex1[tc1]
 extern LLGLSLShader			gTwoTextureAddProgram;
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 8036a4e2585996cbbf934b820d73bd40052b65c1..e51f7b2c714d41bf256a12ef57d7cec1d94e43d7 100755
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -689,6 +689,11 @@ void LLViewerTextEditor::makePristine()
 	LLTextEditor::makePristine();
 }
 
+void LLViewerTextEditor::handleVisibilityChange( BOOL new_visibility )
+{
+	LLUICtrl::handleVisibilityChange(new_visibility);
+}
+
 BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
 {
 	BOOL	handled = FALSE;
diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h
index fb428d0dc14ec1624e91d53998cbead3292432fa..33b78a59641d53a65d730c2c8b8add5685fd11ee 100755
--- a/indra/newview/llviewertexteditor.h
+++ b/indra/newview/llviewertexteditor.h
@@ -46,6 +46,8 @@ class LLViewerTextEditor : public LLTextEditor
 	virtual ~LLViewerTextEditor();
 
 	virtual void makePristine();
+
+	/*virtual*/ void handleVisibilityChange( BOOL new_visibility );
 	
 	// mousehandler overrides
 	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 693eca8a061ba89c39022dfd346a126565e817f8..3da6d33d7281990b74a99608523aac72dc9d8704 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -422,7 +422,9 @@ void LLViewerTextureManager::cleanup()
 	LLViewerFetchedTexture::sDefaultImagep = NULL;	
 	LLViewerFetchedTexture::sSmokeImagep = NULL;
 	LLViewerFetchedTexture::sMissingAssetImagep = NULL;
+	LLTexUnit::sWhiteTexture = 0;
 	LLViewerFetchedTexture::sWhiteImagep = NULL;
+	
 	LLViewerFetchedTexture::sFlatNormalImagep = NULL;
 
 	LLViewerMediaTexture::cleanUpClass() ;	
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cb7536edceb09a8383d11c929dae28695bf63a12..3193a2955b65d94ad636895672b7e1ffbca9afc7 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1860,6 +1860,14 @@ void LLViewerWindow::initBase()
 
 	// Constrain floaters to inside the menu and status bar regions.
 	gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
+	for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i)
+	{
+		LLToolBar * toolbarp = gToolBarView->getToolbar((LLToolBarEnums::EToolBarLocation)i);
+		if (toolbarp)
+		{
+			toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2));
+		}
+	}
 	gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
 	gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
 
@@ -3236,8 +3244,6 @@ void LLViewerWindow::updateUI()
 
 	updateLayout();
 
-	mLastMousePoint = mCurrentMousePoint;
-
 	// cleanup unused selections when no modal dialogs are open
 	if (LLModalDialog::activeCount() == 0)
 	{
@@ -3475,6 +3481,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
 {
 	// Store last mouse location.
 	// If mouse leaves window, pretend last point was on edge of window
+
+	mLastMousePoint = mCurrentMousePoint;
+
 	if (point.mX < 0)
 	{
 		mCurrentMousePoint.mX = 0;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 1e7d1644b2257f3c27251a60269318ca148a4421..c47b6d2335b984fa2c14b6c6720a2c634a272681 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -116,16 +116,16 @@ using namespace LLAvatarAppearanceDefines;
 //-----------------------------------------------------------------------------
 // Global constants
 //-----------------------------------------------------------------------------
-const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
-const LLUUID ANIM_AGENT_BREATHE_ROT	= LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8");  //"breathe_rot"
-const LLUUID ANIM_AGENT_EDITING	= LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb");  //"editing"
-const LLUUID ANIM_AGENT_EYE	= LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea");  //"eye"
-const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e");  //"fly_adjust"
-const LLUUID ANIM_AGENT_HAND_MOTION	= LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578");  //"hand_motion"
-const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d");  //"head_rot"
-const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b");  //"pelvis_fix"
-const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55");  //"target"
-const LLUUID ANIM_AGENT_WALK_ADJUST	= LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d");  //"walk_adjust"
+const LLUUID ANIM_AGENT_BODY_NOISE     = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
+const LLUUID ANIM_AGENT_BREATHE_ROT	   = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8");  //"breathe_rot"
+const LLUUID ANIM_AGENT_EDITING	       = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb");  //"editing"
+const LLUUID ANIM_AGENT_EYE	           = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea");  //"eye"
+const LLUUID ANIM_AGENT_FLY_ADJUST     = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e");  //"fly_adjust"
+const LLUUID ANIM_AGENT_HAND_MOTION	   = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578");  //"hand_motion"
+const LLUUID ANIM_AGENT_HEAD_ROT       = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d");  //"head_rot"
+const LLUUID ANIM_AGENT_PELVIS_FIX     = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b");  //"pelvis_fix"
+const LLUUID ANIM_AGENT_TARGET         = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55");  //"target"
+const LLUUID ANIM_AGENT_WALK_ADJUST	   = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d");  //"walk_adjust"
 const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987");  //"physics_motion"
 
 
@@ -253,7 +253,7 @@ struct LLAppearanceMessageContents
 };
 
 struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock<LLVOAvatarChildJoint>
-	{
+{
 	Alternative<Lazy<struct LLVOAvatarBoneInfo, IS_A_BLOCK> >	bone;
 	Alternative<LLVOAvatarCollisionVolumeInfo>		collision_volume;
 	
@@ -813,17 +813,17 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c
 //------------------------------------------------------------------------
 LLVOAvatar::~LLVOAvatar()
 {
-		if (!mFullyLoaded)
-		{
+	if (!mFullyLoaded)
+	{
 		debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud");
-		}
-		else
-		{
+	}
+	else
+	{
 		debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding");
-		}
+	}
 
 	logPendingPhases();
-
+	
 	lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
 
 	std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer());
@@ -1207,7 +1207,7 @@ void LLVOAvatar::initInstance(void)
 		registerMotion( ANIM_AGENT_TARGET,					LLTargetingMotion::create );
 		registerMotion( ANIM_AGENT_WALK_ADJUST,				LLWalkAdjustMotion::create );
 	}
-	
+
 	LLAvatarAppearance::initInstance();
 	
 	// preload specific motions here
@@ -1646,7 +1646,7 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector
 	return hit;
 }
 
-
+	
 LLVOAvatar* LLVOAvatar::asAvatar()
 {
 	return this;
@@ -1981,22 +1981,22 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU
 	}
 
 	if (!result)
-{
+	{
 		const std::string url = getImageURL(te,uuid);
 		if (!url.empty())
-	{
+		{
 			LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl;
 			result = LLViewerTextureManager::getFetchedTextureFromUrl(
 				url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid);
-	}
-	else
-	{
+		}
+		else
+		{
 			LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl;
 			LLHost host = getObjectHost();
 			result = LLViewerTextureManager::getFetchedTexture(
 				uuid, FTT_HOST_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host);
+		}
 	}
-}
 	return result;
 }
 
@@ -2047,7 +2047,7 @@ void LLVOAvatar::dumpAnimationState()
 //------------------------------------------------------------------------
 // idleUpdate()
 //------------------------------------------------------------------------
-void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
 {
 	LLFastTimer t(FTM_AVATAR_UPDATE);
 
@@ -2102,7 +2102,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 
 	if (isSelf())
 	{
-		LLViewerObject::idleUpdate(agent, world, time);
+		LLViewerObject::idleUpdate(agent, time);
 		
 		// trigger fidget anims
 		if (isAnyAnimationSignaled(AGENT_STAND_ANIMS, NUM_AGENT_STAND_ANIMS))
@@ -2114,7 +2114,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	{
 		// Should override the idleUpdate stuff and leave out the angular update part.
 		LLQuaternion rotation = getRotation();
-		LLViewerObject::idleUpdate(agent, world, time);
+		LLViewerObject::idleUpdate(agent, time);
 		setRotation(rotation);
 	}
 
@@ -4162,7 +4162,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
 		{
 			LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR);
 			if (hair_mesh)
-		{
+			{
 				num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy);
 			}
 			first_pass = FALSE;
@@ -4172,7 +4172,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
 			gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 		}
 	}
-	
+
 	return num_indices;
 }
 
@@ -5237,7 +5237,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age
 //-----------------------------------------------------------------------------
 F32 LLVOAvatar::getTimeDilation()
 {
-	return mTimeDilation;
+	return mRegionp ? mRegionp->getTimeDilation() : 1.f;
 }
 
 
@@ -5289,9 +5289,9 @@ BOOL LLVOAvatar::loadSkeletonNode ()
 {
 	if (!LLAvatarAppearance::loadSkeletonNode())
 	{
-				return FALSE;
-			}
-	
+		return FALSE;
+	}
+
 	// ATTACHMENTS
 	{
 		LLAvatarXmlInfo::attachment_info_list_t::iterator iter;
@@ -5834,7 +5834,8 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO )
 					}
 				}
 			}				
-		}
+}
+
 //-----------------------------------------------------------------------------
 // detachObject()
 //-----------------------------------------------------------------------------
@@ -6047,18 +6048,18 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
 	{
 		const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second;
 		if (texture_dict->mWearableType == type)
-	{
+		{
 			// Thus, you must check to see if the corresponding baked texture is defined.
 			// NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing
 			// this works for detecting a skirt (most important), but is ineffective at any piece of clothing that
 			// gets baked into a texture that always exists (upper or lower).
 			if (texture_dict->mIsUsedByBakedTexture)
-	{
+			{
 				const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
 				return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex);
-	}
+			}
 			return FALSE;
-	}
+		}
 	}
 	return FALSE;
 }
@@ -6123,7 +6124,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL
 			{
 				LLAvatarJointMesh* mesh = (*iter);
 				if (mesh)
-			{
+				{
 					mesh->setColor( color );
 				}
 			}
@@ -6191,9 +6192,9 @@ void LLVOAvatar::updateRezzedStatusTimers()
 		{
 			// load level has decreased. start phase timers for higher load levels.
 			for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++)
-		{
+			{
 				startPhase("load_" + LLVOAvatar::rezStatusToString(i));
-		}
+			}
 		}
 		else if (rez_status > mLastRezzedStatus)
 		{
@@ -6202,16 +6203,16 @@ void LLVOAvatar::updateRezzedStatusTimers()
 			{
 				stopPhase("load_" + LLVOAvatar::rezStatusToString(i));
 				stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false);
-		}
+			}
 			if (rez_status == 3)
-		{
+			{
 				// "fully loaded", mark any pending appearance change complete.
 				selfStopPhase("update_appearance_from_cof");
 				selfStopPhase("wear_inventory_category", false);
 				selfStopPhase("process_initial_wearables_update", false);
 			}
 		}
-		
+
 		mLastRezzedStatus = rez_status;
 	}
 }
@@ -6238,7 +6239,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name)
 }
 
 void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check)
-		{
+{
 	F32 elapsed;
 	bool completed;
 	if (getPhases().getPhaseValues(phase_name, elapsed, completed))
@@ -6270,7 +6271,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check)
 void LLVOAvatar::logPendingPhases()
 {
 	if (!isAgentAvatarValid())
-		{
+	{
 		return;
 	}
 	
@@ -6286,14 +6287,14 @@ void LLVOAvatar::logPendingPhases()
 			if (!completed)
 			{
 				logMetricsTimerRecord(phase_name, elapsed, completed);
-		}
+			}
 		}
 	}
-		}
+}
 
 //static
 void LLVOAvatar::logPendingPhasesAllAvatars()
-		{
+{
 	for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
 		 iter != LLCharacter::sInstances.end(); ++iter)
 	{
@@ -6304,14 +6305,14 @@ void LLVOAvatar::logPendingPhasesAllAvatars()
 		}
 		inst->logPendingPhases();
 	}
-		}
+}
 
 void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed)
-		{
+{
 	if (!isAgentAvatarValid())
-		{
+	{
 		return;
-		}
+	}
 	
 	LLSD record;
 	record["timer_name"] = phase_name;
@@ -6320,15 +6321,15 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse
 	record["completed"] = completed;
 	U32 grid_x(0), grid_y(0);
 	if (getRegion())
-		{
+	{
 		record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion());
 		grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y);
-		}
+	}
 	record["grid_x"] = LLSD::Integer(grid_x);
 	record["grid_y"] = LLSD::Integer(grid_y);
 	record["is_using_server_bakes"] = ((bool) isUsingServerBakes());
 	record["is_self"] = isSelf();
-		
+	
 	if (isAgentAvatarValid())
 	{
 		gAgentAvatarp->addMetricsTimerRecord(record);
@@ -6536,28 +6537,28 @@ void LLVOAvatar::updateMeshTextures()
 										   use_lkg_baked_layer[i],
 										   last_id_string.c_str());
 	}
-
+	
 	for (U32 i=0; i < mBakedTextureDatas.size(); i++)
 	{
 		debugColorizeSubMeshes(i, LLColor4::white);
 
 		LLViewerTexLayerSet* layerset = getTexLayerSet(i);
 		if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() )
-	{
+		{
 			LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID);
 			mBakedTextureDatas[i].mIsUsed = TRUE;
 
 			debugColorizeSubMeshes(i,LLColor4::red);
-	
+
 			avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
 			avatar_joint_mesh_list_t::iterator end  = mBakedTextureDatas[i].mJointMeshes.end();
 			for (; iter != end; ++iter)
-	{
+			{
 				LLAvatarJointMesh* mesh = (*iter);
 				if (mesh)
-		{
+				{
 					mesh->setTexture( baked_img );
-			}
+				}
 			}
 		}
 		else if (!isUsingLocalAppearance() && is_layer_baked[i])
@@ -6601,7 +6602,7 @@ void LLVOAvatar::updateMeshTextures()
 				if (mesh)
 				{
 					mesh->setLayerSet( layerset );
-			}
+				}
 			}
 		}
 		else
@@ -6623,7 +6624,7 @@ void LLVOAvatar::updateMeshTextures()
 		{
 			LLAvatarJointMesh* mesh = (*iter);
 			if (mesh)
-		{
+			{
 				mesh->setColor( color );
 				mesh->setTexture( hair_img );
 			}
@@ -6651,7 +6652,15 @@ void LLVOAvatar::updateMeshTextures()
 			}
 		}
 	}
-	removeMissingBakedTextures();
+
+	// removeMissingBakedTextures() will call back into this rountine if something is removed, and can blow up the stack
+	static bool call_remove_missing = true;	
+	if (call_remove_missing)
+	{
+		call_remove_missing = false;
+		removeMissingBakedTextures();	// May call back into this function if anything is removed
+		call_remove_missing = true;
+	}
 }
 
 // virtual
@@ -6711,13 +6720,13 @@ void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_com
 
 	for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin();
 		 iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter)
-{
+	{
 		const LLMaskedMorph* maskedMorph = (*iter);
 		LLPolyMorphTarget* morph_target = dynamic_cast<LLPolyMorphTarget*>(maskedMorph->mMorphTarget);
 		if (morph_target)
-	{
+		{
 			morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert);
-}
+		}
 	}
 }
 
@@ -7000,8 +7009,8 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value)
 					LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()
 //					param_location_name(vparam->getParamLocation()).c_str()
 		);
-	}
-	
+}
+
 
 void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix,
 	const LLAppearanceMessageContents& contents)
@@ -7015,9 +7024,9 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix,
 	outfile.open(fullpath, LL_APR_WB );
 	apr_file_t* file = outfile.getFileHandle();
 	if (!file)
-		{
-			return;
-		}
+	{
+		return;
+	}
 	else
 	{
 		LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl;
@@ -7051,7 +7060,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix,
 		apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", i, uuid_str.c_str());
 	}
 	apr_file_printf(file, "</textures>\n");
-	}
+}
 
 void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents)
 {
@@ -7068,7 +7077,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe
 		// For future use:
 		//mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0);
 	}
-	
+
 	// Parse visual params, if any.
 	S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
 	bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing
@@ -7296,19 +7305,19 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 			LLVisualParam* param = contents.mParams[i];
 			F32 newWeight = contents.mParamWeights[i];
 
-				if (is_first_appearance_message || (param->getWeight() != newWeight))
+			if (is_first_appearance_message || (param->getWeight() != newWeight))
+			{
+				params_changed = TRUE;
+				if(is_first_appearance_message)
 				{
-					params_changed = TRUE;
-					if(is_first_appearance_message)
-					{
-						param->setWeight(newWeight, FALSE);
-					}
-					else
-					{
-						interp_params = TRUE;
-						param->setAnimationTarget(newWeight, FALSE);
-					}
+					param->setWeight(newWeight, FALSE);
 				}
+				else
+				{
+					interp_params = TRUE;
+					param->setAnimationTarget(newWeight, FALSE);
+				}
+			}
 		}
 		const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
 		if (num_params != expected_tweakable_count)
@@ -7564,12 +7573,12 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
 				avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin();
 				avatar_joint_mesh_list_t::iterator end  = mBakedTextureDatas[i].mJointMeshes.end();
 				for (; iter != end; ++iter)
-			{
+				{
 					LLAvatarJointMesh* mesh = (*iter);
 					if (mesh)
-			{
+					{
 						mesh->setTexture( image_baked );
-			}
+					}
 				}
 			}
 			
@@ -7593,7 +7602,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
 				{
 					LLAvatarJointMesh* mesh = (*iter);
 					if (mesh)
-				{
+					{
 						mesh->setColor( LLColor4::white );
 					}
 				}
@@ -7612,7 +7621,7 @@ std::string get_sequential_numbered_file_name(const std::string& prefix,
 	file_num_type::iterator it = file_nums.find(prefix);
 	S32 num = 0;
 	if (it != file_nums.end())
-{
+	{
 		num = it->second;
 	}
 	file_nums[prefix] = num+1;
@@ -7629,7 +7638,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
 		outprefix = getFullname() + (isSelf()?"_s":"_o");
 	}
 	if (outprefix.empty())
-{
+	{
 		outprefix = getFullname() + (isSelf()?"_s":"_o");
 	}
 	if (outprefix.empty())
@@ -7658,36 +7667,36 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara
 	if (group_by_wearables)
 	{
 		for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++)
-	{
-		const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type);
-		apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
+		{
+			const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type);
+			apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
 
 			for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam())
-		{
-			LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
-			if( (viewer_param->getWearableType() == type) && 
-				(viewer_param->isTweakable() ) )
 			{
+				LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
+				if( (viewer_param->getWearableType() == type) && 
+					(viewer_param->isTweakable() ) )
+				{
 					dump_visual_param(file, viewer_param, viewer_param->getWeight());
+				}
 			}
-		}
 
-		for (U8 te = 0; te < TEX_NUM_INDICES; te++)
-		{
-				if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type)
+			for (U8 te = 0; te < TEX_NUM_INDICES; te++)
 			{
-				// MULTIPLE_WEARABLES: extend to multiple wearables?
-					LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
-				if( te_image )
+				if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type)
 				{
-					std::string uuid_str;
-					te_image->getID().toString( uuid_str );
-					apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
+					// MULTIPLE_WEARABLES: extend to multiple wearables?
+					LLViewerTexture* te_image = getImage((ETextureIndex)te, 0);
+					if( te_image )
+					{
+						std::string uuid_str;
+						te_image->getID().toString( uuid_str );
+						apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str());
+					}
 				}
 			}
 		}
 	}
-		}
 	else 
 	{
 		// Just dump all params sequentially.
@@ -7833,12 +7842,12 @@ void LLVOAvatar::startAppearanceAnimation()
 
 // virtual
 void LLVOAvatar::bodySizeChanged()
-{	
+{
 	if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF())
 	{	// notify simulator of change in size
 		// but not if we are in the middle of updating appearance
 		gAgent.sendAgentSetAppearance();
-}
+	}
 }
 
 BOOL LLVOAvatar::isUsingServerBakes() const
@@ -7850,25 +7859,25 @@ BOOL LLVOAvatar::isUsingServerBakes() const
 	F32 wt = appearance_version_param->getWeight();
 	F32 expect_wt = mUseServerBakes ? 1.0 : 0.0;
 	if (!is_approx_equal(wt,expect_wt))
-{
+	{
 		llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl;
 	}
 #endif
 
 	return mUseServerBakes;
-		}
-		
+}
+
 void LLVOAvatar::setIsUsingServerBakes(BOOL newval)
-		{
+{
 	mUseServerBakes = newval;
 	LLVisualParam* appearance_version_param = getVisualParam(11000);
 	llassert(appearance_version_param);
 	appearance_version_param->setWeight(newval ? 1.0 : 0.0, false);
-		}
+}
 
 // virtual
 void LLVOAvatar::removeMissingBakedTextures()
-			{
+{	
 }
 
 //virtual
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 0e4121f1c496ccc4a9eef2cc4ae818f0ae188100..cd8a5ecdf2584ecf1ec2d22bc65ac4e33b282ffe 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -129,28 +129,28 @@ class LLVOAvatar :
 	/*virtual*/ void			updateGL();
 	/*virtual*/ LLVOAvatar*		asAvatar();
 	virtual U32    	 	 	processUpdateMessage(LLMessageSystem *mesgsys,
-													 void **user_data,
-													 U32 block_num,
-													 const EObjectUpdateType update_type,
-													 LLDataPacker *dp);
-	virtual void   	 	 	idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+												void **user_data,
+												U32 block_num,
+												const EObjectUpdateType update_type,
+												LLDataPacker *dp);
+	virtual void   	 	 	idleUpdate(LLAgent &agent, const F64 &time);
 	/*virtual*/ BOOL   	 	 	updateLOD();
 	BOOL  	 	 	 	 	updateJointLODs();
 	void					updateLODRiggedAttachments( void );
 	/*virtual*/ BOOL   	 	 	isActive() const; // Whether this object needs to do an idleUpdate.
 	S32 						totalTextureMemForUUIDS(std::set<LLUUID>& ids);
-	bool 						allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
-	bool 						allLocalTexturesCompletelyDownloaded() const;
-	bool 						allBakedTexturesCompletelyDownloaded() const;
-	void 						bakedTextureOriginCounts(S32 &sb_count, S32 &host_count,
-														 S32 &both_count, S32 &neither_count);
-	std::string 				bakedTextureOriginInfo();
-	void 						collectLocalTextureUUIDs(std::set<LLUUID>& ids) const;
-	void 						collectBakedTextureUUIDs(std::set<LLUUID>& ids) const;
-	void 						collectTextureUUIDs(std::set<LLUUID>& ids);
-	void						releaseOldTextures();
+	bool 					allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const;
+	bool 					allLocalTexturesCompletelyDownloaded() const;
+	bool 					allBakedTexturesCompletelyDownloaded() const;
+	void 					bakedTextureOriginCounts(S32 &sb_count, S32 &host_count,
+													 S32 &both_count, S32 &neither_count);
+	std::string 			bakedTextureOriginInfo();
+	void 					collectLocalTextureUUIDs(std::set<LLUUID>& ids) const;
+	void 					collectBakedTextureUUIDs(std::set<LLUUID>& ids) const;
+	void 					collectTextureUUIDs(std::set<LLUUID>& ids);
+	void					releaseOldTextures();
 	/*virtual*/ void   	 	 	updateTextures();
-	LLViewerFetchedTexture*		getBakedTextureImage(const U8 te, const LLUUID& uuid);
+	LLViewerFetchedTexture*	getBakedTextureImage(const U8 te, const LLUUID& uuid);
 	/*virtual*/ S32    	 	 	setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim.
 	/*virtual*/ void   	 	 	onShift(const LLVector4a& shift_vector);
 	/*virtual*/ U32    	 	 	getPartitionType() const;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 9ce99444d9647e216699b11d2c0a530ea81e1b9c..082a85e2171ce436477e2dbe6560492f612bd768 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -625,11 +625,11 @@ BOOL LLVOAvatarSelf::isValid() const
 }
 
 // virtual
-void LLVOAvatarSelf::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOAvatarSelf::idleUpdate(LLAgent &agent, const F64 &time)
 {
 	if (isValid())
 	{
-		LLVOAvatar::idleUpdate(agent, world, time);
+		LLVOAvatar::idleUpdate(agent, time);
 		idleUpdateTractorBeam();
 	}
 }
@@ -847,7 +847,7 @@ void LLVOAvatarSelf::removeMissingBakedTextures()
 		if (!tex || tex->isMissingAsset())
 		{
 			LLViewerTexture *imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
-			if (imagep)
+			if (imagep && imagep != tex)
 			{
 				setTEImage(te, imagep);
 				removed = TRUE;
@@ -863,13 +863,13 @@ void LLVOAvatarSelf::removeMissingBakedTextures()
 			layerset->setUpdatesEnabled(TRUE);
 			invalidateComposite(layerset, FALSE);
 		}
-		updateMeshTextures();
+		updateMeshTextures();	// may call back into this function
 		if (getRegion() && !getRegion()->getCentralBakeVersion())
 		{
-		requestLayerSetUploads();
+			requestLayerSetUploads();
+		}
 	}
 }
-}
 
 //virtual
 void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
@@ -1310,7 +1310,7 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr
 			discard_level < local_tex_obj->getDiscard())
 		{
 			local_tex_obj->setDiscard(discard_level);
-				requestLayerSetUpdate(index);
+			requestLayerSetUpdate(index);
 			if (isEditingAppearance())
 			{
 				LLVisualParamHint::requestHintUpdates();
@@ -1799,11 +1799,11 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
 					{
 						requestLayerSetUpdate(type);
 						if (isEditingAppearance())
-					{
-						LLVisualParamHint::requestHintUpdates();
+						{
+							LLVisualParamHint::requestHintUpdates();
+						}
 					}
 				}
-				}
 				else
 				{					
 					tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL);
@@ -2580,25 +2580,25 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
 	//if (!covered_by_baked)
 	{
 		if (imagep->getID() != IMG_DEFAULT_AVATAR)
-	{
+		{
 			imagep->setNoDelete();
 			if (imagep->getDiscardLevel() != 0)
-		{
-			F32 desired_pixels;
-			desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
-
-			imagep->setBoostLevel(getAvatarBoostLevel());
-				imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ;
-			imagep->resetTextureStats();
-			imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
-			imagep->addTextureStats( desired_pixels / texel_area_ratio );
-			imagep->forceUpdateBindStats() ;
-			if (imagep->getDiscardLevel() < 0)
 			{
-				mHasGrey = TRUE; // for statistics gathering
+				F32 desired_pixels;
+				desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
+				
+				imagep->setBoostLevel(getAvatarBoostLevel());
+				imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ;
+				imagep->resetTextureStats();
+				imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
+				imagep->addTextureStats( desired_pixels / texel_area_ratio );
+				imagep->forceUpdateBindStats() ;
+				if (imagep->getDiscardLevel() < 0)
+				{
+					mHasGrey = TRUE; // for statistics gathering
+				}
 			}
 		}
-		}
 		else
 		{
 			// texture asset is missing
@@ -2921,17 +2921,17 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
 
 LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
 {
-	/* switch(index)
-		case TEX_HEAD_BAKED:
-		case TEX_HEAD_BODYPAINT:
-			return mHeadLayerSet; */
+       /* switch(index)
+               case TEX_HEAD_BAKED:
+               case TEX_HEAD_BODYPAINT:
+                       return mHeadLayerSet; */
        const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
-	if (texture_dict->mIsUsedByBakedTexture)
-	{
-		const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+       if (texture_dict->mIsUsedByBakedTexture)
+       {
+               const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
                return getLayerSet(baked_index);
-	}
-	return NULL;
+       }
+       return NULL;
 }
 
 LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const
@@ -2959,7 +2959,7 @@ void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch)
 		gAgentAvatarp->mUseLocalAppearance = true;
 
 		if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
-{
+		{
 			gAgentCamera.changeCameraToCustomizeAvatar();
 		}
 
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 3b7b6bac64a07ed801ef9aa9b4f5905cc687ff02..521c86e1c334214ae6511a3b8939608b122a1111 100755
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -84,7 +84,7 @@ class LLVOAvatarSelf :
 	//--------------------------------------------------------------------
 public:
 	/*virtual*/ void 		updateRegion(LLViewerRegion *regionp);
-	/*virtual*/ void   	 	idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void   	 	idleUpdate(LLAgent &agent, const F64 &time);
 
 	//--------------------------------------------------------------------
 	// LLCharacter interface and related
diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp
index 591d5cae0b139abad2b17e6cfac85f747cbaa32a..600b44d371e96e2fec13576bf1f04a0e3cdc303f 100755
--- a/indra/newview/llvograss.cpp
+++ b/indra/newview/llvograss.cpp
@@ -241,6 +241,7 @@ void LLVOGrass::initClass()
 void LLVOGrass::cleanupClass()
 {
 	for_each(sSpeciesTable.begin(), sSpeciesTable.end(), DeletePairedPointer());
+	sSpeciesTable.clear();
 }
 
 U32 LLVOGrass::processUpdateMessage(LLMessageSystem *mesgsys,
@@ -277,7 +278,7 @@ BOOL LLVOGrass::isActive() const
 	return TRUE;
 }
 
-void LLVOGrass::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOGrass::idleUpdate(LLAgent &agent, const F64 &time)
 {
  	if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_GRASS)))
 	{
diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h
index e54de854122fb871949abaf49decb056fb4962ca..ff4fa6b00d3c4565aa2745c00dd39a7bd2fd47cb 100755
--- a/indra/newview/llvograss.h
+++ b/indra/newview/llvograss.h
@@ -74,7 +74,7 @@ class LLVOGrass : public LLAlphaObject
 	void plantBlades();
 
 	/*virtual*/ BOOL    isActive() const; // Whether this object needs to do an idleUpdate.
-	/*virtual*/ void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
 
 	/*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, 
 										  S32 face = -1,                        // which face to check, -1 = ALL_SIDES
diff --git a/indra/newview/llvoground.cpp b/indra/newview/llvoground.cpp
index 97b7418b40841552d127a214a60751831262af83..c1273e684c190940db4ce64937c3206af78abb90 100755
--- a/indra/newview/llvoground.cpp
+++ b/indra/newview/llvoground.cpp
@@ -49,7 +49,7 @@ LLVOGround::~LLVOGround()
 {
 }
 
-void LLVOGround::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOGround::idleUpdate(LLAgent &agent, const F64 &time)
 {
 }
 
diff --git a/indra/newview/llvoground.h b/indra/newview/llvoground.h
index 290579b4da68337319271c3393cd3022a9d9882f..a53f309e468eefcdaf546a7f569273aa8c4eba97 100755
--- a/indra/newview/llvoground.h
+++ b/indra/newview/llvoground.h
@@ -41,7 +41,7 @@ class LLVOGround : public LLStaticViewerObject
 public:
 	LLVOGround(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 
-	/*virtual*/ void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
 	
 	// Graphical stuff for objects - maybe broken out into render class
 	// later?
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 9497041482b6253823d11c69ba867aa437e9dd4a..050d9dd7858ebbcf7edde2efcba339e3f55b6432 100755
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -261,6 +261,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
 	mSessionTerminateRequested(false),
 	mRelogRequested(false),
 	mConnected(false),
+	mTerminateDaemon(false),
 	mPump(NULL),
 	mSpatialJoiningNum(0),
 
@@ -695,7 +696,7 @@ void LLVivoxVoiceClient::stateMachine()
 		setVoiceEnabled(false);
 	}
 	
-	if(mVoiceEnabled || !mIsInitialized)
+	if(mVoiceEnabled || (!mIsInitialized &&!mTerminateDaemon) )
 	{
 		updatePosition();
 	}
@@ -708,11 +709,12 @@ void LLVivoxVoiceClient::stateMachine()
 		if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
 		{
 			// User turned off voice support.  Send the cleanup messages, close the socket, and reset.
-			if(!mConnected)
+			if(!mConnected || mTerminateDaemon)
 			{
 				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
 				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
 				killGateway();
+				mTerminateDaemon = false;
 			}
 			
 			logout();
@@ -753,7 +755,7 @@ void LLVivoxVoiceClient::stateMachine()
 				// Voice is locked out, we must not launch the vivox daemon.
 				setState(stateJail);
 			}
-			else if(!isGatewayRunning())
+			else if(!isGatewayRunning() && gSavedSettings.getBOOL("EnableVoiceChat"))
 			{
 				if (true)           // production build, not test
 				{
@@ -1136,6 +1138,7 @@ void LLVivoxVoiceClient::stateMachine()
 				std::stringstream errs;
 				errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
 				args["HOSTID"] = errs.str();
+				mTerminateDaemon = true;
 				if (LLGridManager::getInstance()->isSystemGrid())
 				{
 					LLNotificationsUtil::add("NoVoiceConnect", args);	
@@ -2618,6 +2621,7 @@ void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &st
 		std::stringstream errs;
 		errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
 		args["HOSTID"] = errs.str();
+		mTerminateDaemon = true;
 		if (LLGridManager::getInstance()->isSystemGrid())
 		{
 			LLNotificationsUtil::add("NoVoiceConnect", args);	
@@ -2633,6 +2637,7 @@ void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &st
 		LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
 		mVoiceVersion.serverVersion = versionID;
 		mConnectorHandle = connectorHandle;
+		mTerminateDaemon = false;
 		if(getState() == stateConnectorStarting)
 		{
 			setState(stateConnectorStarted);
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index e2d1585c15b2ee0391b73e46a87b49c711e66cdf..c325d72ba6a828d170cb083440afe778eaf204da 100755
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -659,6 +659,8 @@ class LLVivoxVoiceClient :	public LLSingleton<LLVivoxVoiceClient>,
 	LLSocket::ptr_t mSocket;
 	bool mConnected;
 	
+	// We should kill the voice daemon in case of connection alert 
+	bool mTerminateDaemon;
 	
 	LLPumpIO *mPump;
 	friend class LLVivoxProtocolParser;
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 9f4f11b317e508eecf06b7a4289b82f23e45f7a6..54e27ff4c6cf88141e28155019a841a6fd3f95bf 100755
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -200,7 +200,7 @@ void LLVOPartGroup::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
 	mDrawable->setPositionGroup(p);
 }
 
-void LLVOPartGroup::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOPartGroup::idleUpdate(LLAgent &agent, const F64 &time)
 {
 }
 
diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h
index 724e915d02f6dca8d277095079169611d461642a..a94a2291ed95e746aa23439cf3ede407e8d6b326 100755
--- a/indra/newview/llvopartgroup.h
+++ b/indra/newview/llvopartgroup.h
@@ -63,7 +63,7 @@ class LLVOPartGroup : public LLAlphaObject
 	LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 
 	/*virtual*/ BOOL    isActive() const; // Whether this object needs to do an idleUpdate.
-	void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	void idleUpdate(LLAgent &agent, const F64 &time);
 
 	virtual F32 getBinRadius();
 	virtual void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 36793017ed903e96c0f8b65e20b784df6bf35a5f..93f0e50336e90e0da161eb85f4a3411502cfd567 100755
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -1052,7 +1052,7 @@ void LLVOSky::calcAtmospherics(void)
 	mFadeColor.setAlpha(0);
 }
 
-void LLVOSky::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time)
 {
 }
 
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 2a150eccb96b118b3a6300ead23e4d0e0da0cecf..ee8e91fb71d3a869f6e844777665345e5c8d5678 100755
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -461,7 +461,7 @@ class LLVOSky : public LLStaticViewerObject
 	void cleanupGL();
 	void restoreGL();
 
-	/*virtual*/ void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
 	BOOL updateSky();
 	
 	// Graphical stuff for objects - maybe broken out into render class
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index cd12cd95520e70a1e3443bdffeaae2a1bfbc7217..b82c4fe76989a026ab6cc949941f08f870ac4c37 100755
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -269,6 +269,7 @@ void LLVOTree::initClass()
 void LLVOTree::cleanupClass()
 {
 	std::for_each(sSpeciesTable.begin(), sSpeciesTable.end(), DeletePairedPointer());
+	sSpeciesTable.clear();
 }
 
 U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys,
@@ -339,7 +340,7 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys,
 	return retval;
 }
 
-void LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOTree::idleUpdate(LLAgent &agent, const F64 &time)
 {
  	if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE)))
 	{
diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h
index 2ecb0303a1bbd082f6df716abfe1dc3d64301877..6137ae412d9341199cce99908dc30c355d2ca46f 100755
--- a/indra/newview/llvotree.h
+++ b/indra/newview/llvotree.h
@@ -59,7 +59,7 @@ class LLVOTree : public LLViewerObject
 											void **user_data,
 											U32 block_num, const EObjectUpdateType update_type,
 											LLDataPacker *dp);
-	/*virtual*/ void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
 	
 	// Graphical stuff for objects - maybe broken out into render class later?
 	/*virtual*/ void render(LLAgent &agent);
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index e8a1c3d1d62124a3dae881803be76bc33a11d4ea..21595ee0bcfcddd176f61bed301b5217f3032d0f 100755
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -100,7 +100,7 @@ void LLVOWater::updateTextures()
 }
 
 // Never gets called
-void  LLVOWater::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void  LLVOWater::idleUpdate(LLAgent &agent, const F64 &time)
 {
 }
 
diff --git a/indra/newview/llvowater.h b/indra/newview/llvowater.h
index cf9323ef2e3298a878e2e5b5d96b4fa027d7aa51..7a8d8192153571a6ca8958a26374e037fd5cc40f 100755
--- a/indra/newview/llvowater.h
+++ b/indra/newview/llvowater.h
@@ -58,7 +58,7 @@ class LLVOWater : public LLStaticViewerObject
 	static void initClass();
 	static void cleanupClass();
 
-	/*virtual*/ void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time);
 	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
 	/*virtual*/ BOOL        updateGeometry(LLDrawable *drawable);
 	/*virtual*/ void		updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 4e265871848befe736aa18b897751deeba71e994..e7435b6860a962c96c3d7672454627409c933fcd 100755
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -92,7 +92,7 @@ void LLVOWLSky::initSunDirection(LLVector3 const & sun_direction,
 {
 }
 
-void LLVOWLSky::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+void LLVOWLSky::idleUpdate(LLAgent &agent, const F64 &time)
 {
 	
 }
diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h
index 729dced15ea5c83a7b3a543e7dce6b37dd3885f2..1d419b5fea290e62762794636aab1fe37ac182de 100755
--- a/indra/newview/llvowlsky.h
+++ b/indra/newview/llvowlsky.h
@@ -53,7 +53,7 @@ class LLVOWLSky : public LLStaticViewerObject {
 	void initSunDirection(LLVector3 const & sun_direction,
 		LLVector3 const & sun_angular_velocity);
 
-	/*virtual*/ void		 idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+	/*virtual*/ void		 idleUpdate(LLAgent &agent, const F64 &time);
 	/*virtual*/ BOOL		 isActive(void) const;
 	/*virtual*/ LLDrawable * createDrawable(LLPipeline *pipeline);
 	/*virtual*/ BOOL		 updateGeometry(LLDrawable *drawable);
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 103668d0510ce381d2daf42038b9d4698e9b56f7..85614f397c02a3ee269bed82713f6b59378896df 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -143,23 +143,24 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
 	std::string seedUrl;
 	if (regionp)
 	{
-		llinfos << "Region exists, removing it " << llendl;
 		LLHost old_host = regionp->getHost();
 		// region already exists!
 		if (host == old_host && regionp->isAlive())
 		{
 			// This is a duplicate for the same host and it's alive, don't bother.
+			llinfos << "Region already exists and is alive, using existing region" << llendl;
 			return regionp;
 		}
 
 		if (host != old_host)
 		{
 			llwarns << "LLWorld::addRegion exists, but old host " << old_host
-					<< " does not match new host " << host << llendl;
+					<< " does not match new host " << host 
+					<< ", removing old region and creating new" << llendl;
 		}
 		if (!regionp->isAlive())
 		{
-			llwarns << "LLWorld::addRegion exists, but isn't alive" << llendl;
+			llwarns << "LLWorld::addRegion exists, but isn't alive. Removing old region and creating new" << llendl;
 		}
 
 		// Save capabilities seed URL
@@ -169,14 +170,18 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
 		// matches, because all the agent state for the new camera is completely different.
 		removeRegion(old_host);
 	}
+	else
+	{
+		llinfos << "Region does not exist, creating new one" << llendl;
+	}
 
 	U32 iindex = 0;
 	U32 jindex = 0;
 	from_region_handle(region_handle, &iindex, &jindex);
 	S32 x = (S32)(iindex/mWidth);
 	S32 y = (S32)(jindex/mWidth);
-	llinfos << "Adding new region (" << x << ":" << y << ")" << llendl;
-	llinfos << "Host: " << host << llendl;
+	llinfos << "Adding new region (" << x << ":" << y << ")" 
+		<< " on host: " << host << llendl;
 
 	LLVector3d origin_global;
 
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index ae334d4bd24fa7612ec02062cb72a48764de1273..786e4f2de632507fe18f45f1826a7a5d60eca0f4 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1595,14 +1595,6 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask,
 }
 
 
-BOOL outside_slop(S32 x, S32 y, S32 start_x, S32 start_y)
-{
-	S32 dx = x - start_x;
-	S32 dy = y - start_y;
-
-	return (dx <= -2 || 2 <= dx || dy <= -2 || 2 <= dy);
-}
-
 BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask )
 {
 	gFocusMgr.setMouseCapture( this );
@@ -1685,7 +1677,7 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask )
 {
 	if (hasMouseCapture())
 	{
-		if (mPanning || outside_slop(x, y, mMouseDownX, mMouseDownY))
+		if (mPanning || llabs(x - mMouseDownX) > 1 || llabs(y - mMouseDownY) > 1)
 		{
 			// just started panning, so hide cursor
 			if (!mPanning)
@@ -1702,8 +1694,6 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask )
 			sPanY += delta_y;
 			sTargetPanX = sPanX;
 			sTargetPanY = sPanY;
-
-			gViewerWindow->moveCursorToCenter();
 		}
 
 		// doesn't matter, cursor should be hidden
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index 703015af20081678693a8f0d72ad20312f1dd2e4..9668cfa526e6157c88bab138272c675e9b3dd078 100755
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -9,63 +9,7 @@
  save_rect="true"
  title="ABOUT [CAPITALIZED_APP_NAME]"
  width="470">
-  <floater.string
-     name="AboutHeader">
-[APP_NAME] [VIEWER_VERSION_0].[VIEWER_VERSION_1].[VIEWER_VERSION_2] ([VIEWER_VERSION_3]) [BUILD_DATE] [BUILD_TIME] ([CHANNEL])
-[[VIEWER_RELEASE_NOTES_URL] [ReleaseNotes]]
-
-</floater.string>
-  <floater.string
-     name="AboutCompiler">
-Built with [COMPILER] version [COMPILER_VERSION]
-
-</floater.string>
-  <floater.string
-     name="AboutPosition">
-You are at [POSITION_LOCAL_0,number,1], [POSITION_LOCAL_1,number,1], [POSITION_LOCAL_2,number,1] in [REGION] located at &lt;nolink&gt;[HOSTNAME]&lt;/nolink&gt; ([HOSTIP])
-SLURL: &lt;nolink&gt;[SLURL]&lt;/nolink&gt;
-(global coordinates [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1])
-[SERVER_VERSION]
-[SERVER_RELEASE_NOTES_URL]
-
-</floater.string>
-  <!-- *NOTE: Do not translate text like GPU, Graphics Card, etc -
-       Most PC users who know what these mean will be used to the English versions,
-       and this info sometimes gets sent to support. -->
-  <floater.string
-     name="AboutSystem">
-CPU: [CPU]
-Memory: [MEMORY_MB] MB
-OS Version: [OS_VERSION]
-Graphics Card Vendor: [GRAPHICS_CARD_VENDOR]
-Graphics Card: [GRAPHICS_CARD]
-</floater.string>
-  <floater.string
-     name="AboutDriver">
-Windows Graphics Driver Version: [GRAPHICS_DRIVER_VERSION]
-</floater.string>
-  <floater.string
-     name="AboutLibs">
-OpenGL Version: [OPENGL_VERSION]
-
-libcurl Version: [LIBCURL_VERSION]
-J2C Decoder Version: [J2C_VERSION]
-Audio Driver Version: [AUDIO_DRIVER_VERSION]
-Qt Webkit Version: [QT_WEBKIT_VERSION]
-Voice Server Version: [VOICE_VERSION]
-</floater.string>
-  <floater.string
-     name="none">
-      (none)
-  </floater.string>
-  <floater.string
-     name="AboutTraffic">
-Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)
-</floater.string>
-<floater.string
-     name="ErrorFetchingServerReleaseNotesURL">
-Error fetching server release notes URL.
-</floater.string>
+  
   <tab_container
     follows="all" 
     top="25"
diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
index 7c7ee2df4cba54d28e78a7e4bd927cdb58f0d25c..99b812a880720be5633a4a5e4a9a1ea0e43d2372 100755
--- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
+++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
@@ -10,33 +10,34 @@
   width="600"
   default_tab_group="1">
   <text_editor
-  left="10"
-   type="string"
-   length="1"
-   follows="left|right|bottom"
-   font="Monospace"
-   height="366"
-   width="576"
-   ignore_tab="false"
-   layout="topleft"
-   max_length="65536"
-   name="region_debug_console_output"
-   show_line_numbers="false" 
-   word_wrap="true"
-   track_end="true"
-   read_only="true">
+    left="10"
+    type="string"
+    length="1"
+    follows="all"
+    font="Monospace"
+    height="366"
+    width="576"
+    ignore_tab="false"
+    layout="topleft"
+    max_length="65536"
+    name="region_debug_console_output"
+    show_line_numbers="false" 
+    word_wrap="true"
+    track_end="true"
+    read_only="true">
   </text_editor>
   <line_editor
-   border_style="line"
-   border_thickness="1"
-   tab_group="1" 
-   follows="left|top|right"
-   font="SansSerif"
-   height="19"
-   layout="topleft"
-   bottom_delta="20"
-   max_length="127"
-   name="region_debug_console_input"
-   top_delta="0"
-   width="576" />
+    border_style="line"
+    border_thickness="1"
+    tab_group="1"
+    follows="left|right|bottom"
+    font="SansSerif"
+    height="19"
+    layout="topleft"
+    bottom_delta="20"
+    max_length="127"
+    name="region_debug_console_input"
+    top_delta="0"
+    width="576">
+  </line_editor>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml
index 77b9095f7cdf9996cc9e2506f662b2533f0b3912..410caa72908b2d8225f23a11300c259f9ff962a6 100755
--- a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml
+++ b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml
@@ -30,6 +30,12 @@
      name="Offer Teleport">
         <on_click function="AvatarIcon.Action" parameter="teleport"/>
     </menu_item_call>
+    <menu_item_call
+     label="Request Teleport"
+     layout="topleft"
+     name="Request Teleport">
+        <on_click function="AvatarIcon.Action" parameter="request_teleport"/>      
+    </menu_item_call>
     <menu_item_call
      label="Voice call"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 64de010eb5c554dbf47796ac4b48a5c6870e4c64..7e8d2aaf9a697a7db87ea7dba1a2e31f286ad14f 100755
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -1381,8 +1381,7 @@
              label="Report Bug"
              name="Report Bug">
                 <menu_item_call.on_click
-                 function="ShowHelp"
-                 parameter="report_bug" />
+                 function="Advanced.ReportBug"/>
             </menu_item_call>
 
         <menu_item_separator/>
@@ -2397,6 +2396,12 @@
             <menu_item_call.on_click
              function="Advanced.ClickRenderProfile" />
           </menu_item_call>
+            <menu_item_call
+             label="Benchmark"
+             name="Benchmark">
+              <menu_item_call.on_click
+               function="Advanced.ClickRenderBenchmark" />
+          </menu_item_call>
         </menu>
       <menu
         create_jump_keys="true"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index a93601f5fd382a8746afcdc7583cb134a1d0aff7..c97af4e9ef82f4092b3bab4633809372674c1763 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4756,6 +4756,14 @@ Problems adding a new estate manager.  One or more estates may have a full manag
   <tag>fail</tag>
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="ProblemAddingEstateBanManager"
+   type="alertmodal">
+Unable to add estate owner or manager to ban list.
+    <tag>fail</tag>
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="ProblemAddingEstateGeneric"
@@ -9291,10 +9299,19 @@ Link failed -- insufficient land resources
 Object uses too many physics resources -- its dynamics have been disabled.
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="EstateManagerFailedllTeleportHome"
+   persist="false"
+   type="notify">
+    <tag>fail</tag>
+The object '[OBJECT_NAME]' at [SLURL] cannot teleport estate managers home.
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="TeleportedHomeByObjectOnParcel"
-   persist="true"
+   persist="false"
    type="notify">
    <tag>fail</tag>
 You have been teleported home by the object '[OBJECT_NAME]' on the parcel '[PARCEL_NAME]'
@@ -9303,7 +9320,7 @@ You have been teleported home by the object '[OBJECT_NAME]' on the parcel '[PARC
   <notification
    icon="alertmodal.tga"
    name="TeleportedHomeByObject"
-   persist="true"
+   persist="false"
    type="notify">
    <tag>fail</tag>
 You have been teleported home by the object '[OBJECT_NAME]'
@@ -9747,15 +9764,7 @@ Only the first 10 selected objects have been disabled. Refresh and make addition
    type="notify">
    <tag>fail</tag>
 You need to update your viewer to buy this parcel.
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
-   name="LandBuyAccessBlocked"
-   type="notify">
-   <tag>fail</tag>
-You can't buy this land due to your maturity Rating. You may need to validate your age and/or install the latest Viewer. Please go to the Knowledge Base for details on accessing areas with this maturity Rating.
-  </notification>
+  </notification>  
 
   <notification
    icon="alertmodal.tga"
@@ -9818,7 +9827,9 @@ Not enough leased parcels in selection to join.
    name="CantDivideLandMultipleParcelsSelected"
    type="notify">
    <tag>fail</tag>
-Can't divide land.\nThere is more than one parcel selected.\nTry selecting a smaller piece of land.
+Can't divide land.
+There is more than one parcel selected.
+Try selecting a smaller piece of land.
   </notification>
 
   <notification
@@ -9826,7 +9837,9 @@ Can't divide land.\nThere is more than one parcel selected.\nTry selecting a sma
    name="CantDivideLandCantFindParcel"
    type="notify">
    <tag>fail</tag>
-Can't divide land.\nCan't find the parcel.\nPlease report with Help -> Reprt Bug...
+Can't divide land.
+Can't find the parcel.
+Please report with Help -> Report Bug...
   </notification>
 
   <notification
@@ -9834,7 +9847,8 @@ Can't divide land.\nCan't find the parcel.\nPlease report with Help -> Reprt Bug
    name="CantDivideLandWholeParcelSelected"
    type="notify">
    <tag>fail</tag>
-Can't divide land. Whole parcel is selected.\nTry selecting a smaller piece of land.
+Can't divide land. Whole parcel is selected.
+Try selecting a smaller piece of land.
   </notification>
 
   <notification
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 38b680ba86553a21a7f632183d2015d4848a8249..26f54bacbccf516f2c5bd72103ae23d5dd63e5fd 100755
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
  label="General"
- height="604"
+ height="420"
  width="304"
  class="panel_group_general"
  name="general_tab">
@@ -101,31 +101,7 @@ Hover your mouse over the options for more help.
     text_readonly_color="White"
      word_wrap="true">
      Group Charter
-    </text_editor>
-    <name_list
-     column_padding="0"
-     draw_heading="true"
-     follows="left|top|right"
-     heading_height="23"
-     height="160"
-     layout="topleft"
-     left="0"
-     name="visible_members"
-     short_names="false" 
-     top_pad="2">
-        <name_list.columns
-         label="Member"
-         name="name"
-         relative_width="0.4" />
-        <name_list.columns
-         label="Title"
-         name="title"
-         relative_width="0.4" />
-        <name_list.columns
-         label="Status"
-         name="status"
-         relative_width="0.2" />
-      </name_list>
+    </text_editor>   
          <text
          follows="left|top|right"
          type="string"
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index 206496cc0e8eb0608310c52d5e7983fc56b50b20..b3326d8da62349ac4c02834098fa8ddbbae205f3 100755
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -131,7 +131,7 @@ background_visible="true"
             expanded="false"
             layout="topleft"
             name="group_roles_tab"
-            title="Roles"
+            title="Roles &amp; Members"
             fit_panel="false">
                 <panel
                    border="false"
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index df91ad8b5e537d6cd03cad1c95f0bdf115e13ab3..9ac5b8800ed833e19c4eb9553ec30a81dccfa1b7 100755
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -94,11 +94,15 @@ clicking on their names.
                 <name_list.columns
                  label="Donation"
                  name="donated"
-         relative_width="0.25" />
+         		 relative_width="0.2" />
                 <name_list.columns
                  label="Status"
                  name="online"
-                 relative_width="0.14" />
+                 relative_width="0.18" />
+                <name_list.columns
+                 label="Title"
+                 name="title"
+                 relative_width="0.18" />
             </name_list>
             <button
              height="23"
diff --git a/indra/newview/skins/default/xui/en/panel_social_photo.xml b/indra/newview/skins/default/xui/en/panel_social_photo.xml
index a55613b52a92681945ebec98ae09c048664e3106..c79a246d9d137a752e0e5a83bd4e389da6582828 100644
--- a/indra/newview/skins/default/xui/en/panel_social_photo.xml
+++ b/indra/newview/skins/default/xui/en/panel_social_photo.xml
@@ -113,14 +113,6 @@
              type="string"
              word_wrap="true">
             </text_editor>
-            <check_box
-             follows="left|top"
-             initial_value="true"
-             label="Include location in posting"
-             name="add_location_cb"
-              left="9"
-              height="16"
-             top_pad="8"/>
         </layout_panel>
         <layout_panel
           name="photo_button_panel"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 7e79d297ef6af6a392e40a5fd7742d0df422f001..67f75fe1d21ad547353f5d58b50ede95206e6dc8 100755
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -20,6 +20,42 @@
 	<string name="StartupInitializingVFS">Initializing VFS...</string>
 	<string name="StartupRequireDriverUpdate">Graphics initialization failed. Please update your graphics driver!</string>
 
+	<!-- about dialog/support string-->
+	<string name="AboutHeader">
+[APP_NAME] [VIEWER_VERSION_0].[VIEWER_VERSION_1].[VIEWER_VERSION_2] ([VIEWER_VERSION_3]) [BUILD_DATE] [BUILD_TIME] ([CHANNEL])
+[[VIEWER_RELEASE_NOTES_URL] [ReleaseNotes]]
+	</string>
+	<string name="AboutCompiler">Built with [COMPILER] version [COMPILER_VERSION]</string>
+	<string name="AboutPosition">
+You are at [POSITION_LOCAL_0,number,1], [POSITION_LOCAL_1,number,1], [POSITION_LOCAL_2,number,1] in [REGION] located at &lt;nolink&gt;[HOSTNAME]&lt;/nolink&gt; ([HOSTIP])
+SLURL: &lt;nolink&gt;[SLURL]&lt;/nolink&gt;
+(global coordinates [POSITION_0,number,1], [POSITION_1,number,1], [POSITION_2,number,1])
+[SERVER_VERSION]
+[SERVER_RELEASE_NOTES_URL]
+	</string>
+	<!-- *NOTE: Do not translate text like GPU, Graphics Card, etc -
+       Most PC users who know what these mean will be used to the English versions,
+       and this info sometimes gets sent to support. -->
+	<string name="AboutSystem">
+CPU: [CPU]
+Memory: [MEMORY_MB] MB
+OS Version: [OS_VERSION]
+Graphics Card Vendor: [GRAPHICS_CARD_VENDOR]
+Graphics Card: [GRAPHICS_CARD]
+	</string>
+	<string name="AboutDriver">Windows Graphics Driver Version: [GRAPHICS_DRIVER_VERSION]</string>
+	<string name="AboutLibs">
+OpenGL Version: [OPENGL_VERSION]
+
+libcurl Version: [LIBCURL_VERSION]
+J2C Decoder Version: [J2C_VERSION]
+Audio Driver Version: [AUDIO_DRIVER_VERSION]
+Qt Webkit Version: [QT_WEBKIT_VERSION]
+Voice Server Version: [VOICE_VERSION]
+	</string>
+	<string name="AboutTraffic">Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)</string>
+	<string name="ErrorFetchingServerReleaseNotesURL">Error fetching server release notes URL.</string>
+	
 	<!--  progress -->
 	<string name="ProgressRestoring">Restoring...</string>
 	<string name="ProgressChangingResolution">Changing resolution...</string>
@@ -2303,8 +2339,7 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale
 	<string name="InvFolder Merchant Outbox">Merchant Outbox</string>
 
   <!-- are used for Friends and Friends/All folders in Inventory "Calling cards" folder. See EXT-694-->
-	<string name="InvFolder Friends">Friends</string>
-	<string name="InvFolder Received Items">Received Items</string>
+	<string name="InvFolder Friends">Friends</string>	
 	<string name="InvFolder All">All</string>
 
 	<string name="no_attachments">No attachments worn</string>
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 96b4c7268c54ffed3394caf68e33321694c657a1..f7b3a45e8da33d9ef137cec77bf616d5060ebc26 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -7,7 +7,7 @@
 
 $LicenseInfo:firstyear=2006&license=viewerlgpl$
 Second Life Viewer Source Code
-Copyright (C) 2006-2011, Linden Research, Inc.
+Copyright (C) 2006-2014, Linden Research, Inc.
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -622,7 +622,22 @@ def package_finish(self):
         NSIS_path = os.path.expandvars('${ProgramFiles}\\NSIS\\Unicode\\makensis.exe')
         if not os.path.exists(NSIS_path):
             NSIS_path = os.path.expandvars('${ProgramFiles(x86)}\\NSIS\\Unicode\\makensis.exe')
-        self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile))
+        installer_created=False
+        nsis_attempts=3
+        nsis_retry_wait=15
+        while (not installer_created) and (nsis_attempts > 0):
+            try:
+                nsis_attempts-=1;
+                self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile))
+                installer_created=True # if no exception was raised, the codesign worked
+            except ManifestError, err:
+                if nsis_attempts:
+                    print >> sys.stderr, "nsis failed, waiting %d seconds before retrying" % nsis_retry_wait
+                    time.sleep(nsis_retry_wait)
+                    nsis_retry_wait*=2
+                else:
+                    print >> sys.stderr, "Maximum nsis attempts exceeded; giving up"
+                    raise
         # self.remove(self.dst_path_of(tempfile))
         # If we're on a build machine, sign the code using our Authenticode certificate. JC
         sign_py = os.path.expandvars("${SIGN}")
@@ -734,7 +749,6 @@ def path_optional(src, dst):
                                 "libcollada14dom.dylib",
                                 "libexpat.1.5.2.dylib",
                                 "libexception_handler.dylib",
-                                "libfmodex.dylib",
                                 "libGLOD.dylib",
                                 ):
                     dylibs += path_optional(os.path.join(libdir, libfile), libfile)
@@ -750,6 +764,20 @@ def path_optional(src, dst):
                                 'SLVoice',
                                 ):
                      self.path2basename(libdir, libfile)
+
+                # dylibs that vary based on configuration
+                if self.args['configuration'].lower() == 'debug':
+                    for libfile in (
+                                "libfmodexL.dylib",
+                                ):
+                        dylibs += path_optional(os.path.join("../packages/lib/debug",
+                                                             libfile), libfile)
+                else:
+                    for libfile in (
+                                "libfmodex.dylib",
+                                ):
+                        dylibs += path_optional(os.path.join("../packages/lib/release",
+                                                             libfile), libfile)
                 
                 # our apps
                 for app_bld_dir, app in (("mac_crash_logger", "mac-crash-logger.app"),