From aaf6c7954d83917d2c461bf606cac6b446a5a0ba Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Wed, 6 Nov 2013 11:42:48 +0200
Subject: MAINT-3374 FIXED Don't show username after display name if this
 setting is disabled.

---
 indra/llcommon/llavatarname.cpp | 17 ++++++++++++++++-
 indra/llcommon/llavatarname.h   |  6 ++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index 642bd82e90..d12f157910 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 5d2fccc5ba..1cb3ae421f 100755
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -54,6 +54,9 @@ public:
 	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 @@ private:
 	// 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
-- 
cgit v1.2.3


From d7b902d57503dddca59c3d7a772e4f6a454afa7b Mon Sep 17 00:00:00 2001
From: Baker Linden <baker@lindenlab.com>
Date: Fri, 14 Feb 2014 13:56:36 -0800
Subject: [MAINT-3555] Crash in LLPanel::~LLPanel() on shutdown - Added clear()
 after DeletePointer() call to hopfully fix this...

---
 indra/llcommon/llerror.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index d2af004cde..853f279c95 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();
-- 
cgit v1.2.3


From 38915f119c5bf3d85084b12939ad815f68fefad0 Mon Sep 17 00:00:00 2001
From: simon <none@none>
Date: Fri, 14 Feb 2014 14:57:08 -0800
Subject: More memory cleanup of containers after DeletePairedPointer() usage.

---
 indra/llcommon/llfasttimer.cpp | 1 +
 indra/llcommon/llstl.h         | 1 +
 2 files changed, 2 insertions(+)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 01b6e60d2b..58db7d0d17 100755
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -119,6 +119,7 @@ public:
 	~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 d3941e1bc9..0a39288f5a 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
 {
-- 
cgit v1.2.3


From e6c85c46c4e301c54391280f3e63765158ea1708 Mon Sep 17 00:00:00 2001
From: maksymsproductengine <maksymsproductengine@lindenlab.com>
Date: Wed, 5 Feb 2014 20:45:09 +0200
Subject: MAINT-3555 crash in LLPanel::~LLPanel() on shutdown:  - memory leaks
 fixing;

---
 indra/llcommon/llerror.cpp | 68 ++++++++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 30 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 853f279c95..925fca1b4b 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -207,6 +207,10 @@ namespace {
 #endif
 }
 
+namespace LLError
+{
+	void clean();
+}
 
 namespace
 {
@@ -352,7 +356,11 @@ namespace
 		Globals()
 			:	messageStreamInUse(false)
 			{ }
-		
+
+		~Globals()
+		{
+			LLError::clean();
+		}
 	};
 
 	void Globals::addCallSite(LLError::CallSite& site)
@@ -380,8 +388,9 @@ namespace
 		   is.
 		   See C++ FAQ Lite, sections 10.12 through 10.14
 		*/
-		static Globals* globals = new Globals;		
-		return *globals;
+
+		static Globals globals;
+		return globals;
 	}
 }
 
@@ -415,6 +424,7 @@ namespace LLError
 		static void reset();
 		static Settings* saveAndReset();
 		static void restore(Settings*);
+		static void clean();
 		
 	private:
 		Settings()
@@ -446,6 +456,15 @@ namespace LLError
 		}
 		return *p;
 	}
+
+	void Settings::clean()
+	{
+		Globals::get().invalidateCallSites();
+
+		Settings*& p = getPtr();
+		delete p;
+		p = NULL;
+	}
 	
 	void Settings::reset()
 	{
@@ -480,10 +499,7 @@ namespace LLError
 		static Settings* currentSettings = NULL;
 		return currentSettings;
 	}
-}
 
-namespace LLError
-{
 	CallSite::CallSite(ELevel level,
 					const char* file,
 					int line,
@@ -721,11 +737,7 @@ namespace LLError
 			setLevels(s.tagLevelMap,		entry["tags"],		level);
 		}
 	}
-}
-
 
-namespace LLError
-{
 	Recorder::~Recorder()
 		{ }
 
@@ -756,18 +768,26 @@ namespace LLError
 			std::remove(s.recorders.begin(), s.recorders.end(), recorder),
 			s.recorders.end());
 	}
-}
 
-namespace LLError
-{
+	void deleteRecorder(LLError::Settings& settings)
+	{
+		removeRecorder(settings.fileRecorder);
+		delete settings.fileRecorder;
+		settings.fileRecorder = NULL;
+		settings.fileRecorderFileName.clear();
+	}
+
+	void clean()
+	{
+		deleteRecorder(LLError::Settings::get());
+		LLError::Settings::clean();
+	}
+
 	void logToFile(const std::string& file_name)
 	{
 		LLError::Settings& s = LLError::Settings::get();
 
-		removeRecorder(s.fileRecorder);
-		delete s.fileRecorder;
-		s.fileRecorder = NULL;
-		s.fileRecorderFileName.clear();
+		deleteRecorder(s);
 		
 		if (file_name.empty())
 		{
@@ -839,8 +859,6 @@ namespace
 			}
 		}
 	}
-}
-
 
 /*
 Recorder formats:
@@ -870,7 +888,6 @@ You get:
 	
 */
 
-namespace {
 	bool checkLevelMap(const LevelMap& map, const std::string& key,
 						LLError::ELevel& level)
 	{
@@ -1127,13 +1144,7 @@ namespace LLError
 			s.crashFunction(message);
 		}
 	}
-}
-
-
-
 
-namespace LLError
-{
 	Settings* saveAndResetSettings()
 	{
 		return Settings::saveAndReset();
@@ -1226,10 +1237,7 @@ namespace LLError
 
 		return chars ? time_str : "time error";
 	}
-}
-
-namespace LLError
-{     
+     
 	char** LLCallStacks::sBuffer = NULL ;
 	S32    LLCallStacks::sIndex  = 0 ;
 
-- 
cgit v1.2.3


From ba0b11fee19b917d26e841f4466d221a50a185b6 Mon Sep 17 00:00:00 2001
From: maksymsproductengine <maksymsproductengine@lindenlab.com>
Date: Thu, 20 Feb 2014 19:45:47 +0200
Subject: Fix build problem

---
 indra/llcommon/llerror.cpp | 68 ++++++++++++++++++++--------------------------
 1 file changed, 30 insertions(+), 38 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 925fca1b4b..853f279c95 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -207,10 +207,6 @@ namespace {
 #endif
 }
 
-namespace LLError
-{
-	void clean();
-}
 
 namespace
 {
@@ -356,11 +352,7 @@ namespace
 		Globals()
 			:	messageStreamInUse(false)
 			{ }
-
-		~Globals()
-		{
-			LLError::clean();
-		}
+		
 	};
 
 	void Globals::addCallSite(LLError::CallSite& site)
@@ -388,9 +380,8 @@ namespace
 		   is.
 		   See C++ FAQ Lite, sections 10.12 through 10.14
 		*/
-
-		static Globals globals;
-		return globals;
+		static Globals* globals = new Globals;		
+		return *globals;
 	}
 }
 
@@ -424,7 +415,6 @@ namespace LLError
 		static void reset();
 		static Settings* saveAndReset();
 		static void restore(Settings*);
-		static void clean();
 		
 	private:
 		Settings()
@@ -456,15 +446,6 @@ namespace LLError
 		}
 		return *p;
 	}
-
-	void Settings::clean()
-	{
-		Globals::get().invalidateCallSites();
-
-		Settings*& p = getPtr();
-		delete p;
-		p = NULL;
-	}
 	
 	void Settings::reset()
 	{
@@ -499,7 +480,10 @@ namespace LLError
 		static Settings* currentSettings = NULL;
 		return currentSettings;
 	}
+}
 
+namespace LLError
+{
 	CallSite::CallSite(ELevel level,
 					const char* file,
 					int line,
@@ -737,7 +721,11 @@ namespace LLError
 			setLevels(s.tagLevelMap,		entry["tags"],		level);
 		}
 	}
+}
+
 
+namespace LLError
+{
 	Recorder::~Recorder()
 		{ }
 
@@ -768,26 +756,18 @@ namespace LLError
 			std::remove(s.recorders.begin(), s.recorders.end(), recorder),
 			s.recorders.end());
 	}
+}
 
-	void deleteRecorder(LLError::Settings& settings)
-	{
-		removeRecorder(settings.fileRecorder);
-		delete settings.fileRecorder;
-		settings.fileRecorder = NULL;
-		settings.fileRecorderFileName.clear();
-	}
-
-	void clean()
-	{
-		deleteRecorder(LLError::Settings::get());
-		LLError::Settings::clean();
-	}
-
+namespace LLError
+{
 	void logToFile(const std::string& file_name)
 	{
 		LLError::Settings& s = LLError::Settings::get();
 
-		deleteRecorder(s);
+		removeRecorder(s.fileRecorder);
+		delete s.fileRecorder;
+		s.fileRecorder = NULL;
+		s.fileRecorderFileName.clear();
 		
 		if (file_name.empty())
 		{
@@ -859,6 +839,8 @@ namespace
 			}
 		}
 	}
+}
+
 
 /*
 Recorder formats:
@@ -888,6 +870,7 @@ You get:
 	
 */
 
+namespace {
 	bool checkLevelMap(const LevelMap& map, const std::string& key,
 						LLError::ELevel& level)
 	{
@@ -1144,7 +1127,13 @@ namespace LLError
 			s.crashFunction(message);
 		}
 	}
+}
+
+
+
 
+namespace LLError
+{
 	Settings* saveAndResetSettings()
 	{
 		return Settings::saveAndReset();
@@ -1237,7 +1226,10 @@ namespace LLError
 
 		return chars ? time_str : "time error";
 	}
-     
+}
+
+namespace LLError
+{     
 	char** LLCallStacks::sBuffer = NULL ;
 	S32    LLCallStacks::sIndex  = 0 ;
 
-- 
cgit v1.2.3