From cdbfdfc351a51f4fe0c264110cf68a59f0859f04 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Thu, 11 Oct 2012 17:02:45 -0500
Subject: MAINT-1709 Factor out realloc

Reviewed by VoidPointer
---
 indra/llmath/lloctree.h              | 52 ++++++++-----------
 indra/newview/llspatialpartition.cpp | 98 +++++++++++++++++++-----------------
 indra/newview/llspatialpartition.h   | 10 ++--
 3 files changed, 80 insertions(+), 80 deletions(-)

(limited to 'indra')

diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index c3f6f7de2a..68d8110f1d 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -78,7 +78,7 @@ public:
 
 	typedef LLOctreeTraveler<T>									oct_traveler;
 	typedef LLTreeTraveler<T>									tree_traveler;
-	typedef LLPointer<T>*										element_list;
+	typedef std::vector<LLPointer<T>>							element_list;
 	typedef LLPointer<T>*										element_iter;
 	typedef const LLPointer<T>*									const_element_iter;
 	typedef typename std::vector<LLTreeListener<T>*>::iterator	tree_listener_iter;
@@ -106,8 +106,9 @@ public:
 	:	mParent((oct_node*)parent), 
 		mOctant(octant) 
 	{ 
-		mData = NULL;
-		mDataEnd = NULL;
+		//always keep a NULL terminated list to avoid out of bounds exceptions in debug builds
+		mData.push_back(NULL);
+		mDataEnd = &mData[0];
 
 		mCenter = center;
 		mSize = size;
@@ -133,9 +134,9 @@ public:
 			mData[i] = NULL;
 		}
 
-		free(mData);
-		mData = NULL;
-		mDataEnd = NULL;
+		mData.clear();
+		mData.push_back(NULL);
+		mDataEnd = &mData[0];
 
 		for (U32 i = 0; i < getChildCount(); i++)
 		{
@@ -239,9 +240,9 @@ public:
 	bool isEmpty() const							{ return mElementCount == 0; }
 	element_list& getData()							{ return mData; }
 	const element_list& getData() const				{ return mData; }
-	element_iter getDataBegin()						{ return mData; }
+	element_iter getDataBegin()						{ return &mData[0]; }
 	element_iter getDataEnd()						{ return mDataEnd; }
-	const_element_iter getDataBegin() const			{ return mData; }
+	const_element_iter getDataBegin() const			{ return &mData[0]; }
 	const_element_iter getDataEnd() const			{ return mDataEnd; }
 		
 	U32 getChildCount()	const						{ return mChildCount; }
@@ -321,14 +322,10 @@ public:
 			if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||
 				(data->getBinRadius() > getSize()[0] &&	parent && parent->getElementCount() >= gOctreeMaxCapacity))) 
 			{ //it belongs here
+				mData.push_back(NULL);
+				mData[mElementCount] = data;
 				mElementCount++;
-				mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount);
-
-				//avoid unref on uninitialized memory
-				memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>));
-
-				mData[mElementCount-1] = data;
-				mDataEnd = mData + mElementCount;
+				mDataEnd = &mData[mElementCount];
 				data->setBinIndex(mElementCount-1);
 				BaseType::insert(data);
 				return true;
@@ -364,14 +361,10 @@ public:
 
 				if( lt == 0x7 )
 				{
+					mData.push_back(NULL);
+					mData[mElementCount] = data;
 					mElementCount++;
-					mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount);
-
-					//avoid unref on uninitialized memory
-					memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>));
-
-					mData[mElementCount-1] = data;
-					mDataEnd = mData + mElementCount;
+					mDataEnd = &mData[mElementCount];
 					data->setBinIndex(mElementCount-1);
 					BaseType::insert(data);
 					return true;
@@ -436,16 +429,15 @@ public:
 				mData[i]->setBinIndex(i);
 			}
 
-			mData[mElementCount] = NULL; //needed for unref
-			mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount);
-			mDataEnd = mData+mElementCount;
+			mData[mElementCount] = NULL;
+			mData.pop_back();
+			mDataEnd = &mData[mElementCount];
 		}
 		else
 		{
-			mData[0] = NULL; //needed for unref
-			free(mData);
-			mData = NULL;
-			mDataEnd = NULL;
+			mData.clear();
+			mData.push_back(NULL);
+			mDataEnd = &mData[0];
 		}
 
 		notifyRemoval(data);
@@ -491,7 +483,7 @@ public:
 		}
 
 		//node is now root
-		llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl;
+		llwarns << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl;
 		node->removeByAddress(data);
 		llassert(data->getBinIndex() == -1);
 		return true;
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 7264ba3cab..3bb8e60787 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -4713,55 +4713,63 @@ LLCullResult::LLCullResult()
 	mVisibleListAllocated = 0;
 	mVisibleBridgeAllocated = 0;
 
-	mVisibleGroups = NULL;
-	mVisibleGroupsEnd = NULL;
-	mAlphaGroups = NULL;
-	mAlphaGroupsEnd = NULL;
-	mOcclusionGroups = NULL;
-	mOcclusionGroupsEnd = NULL;
-	mDrawableGroups = NULL;
-	mDrawableGroupsEnd = NULL;
-	mVisibleList = NULL;
-	mVisibleListEnd = NULL;
-	mVisibleBridge = NULL;
-	mVisibleBridgeEnd = NULL;
+	mVisibleGroups.clear();
+	mVisibleGroups.push_back(NULL);
+	mVisibleGroupsEnd = &mVisibleGroups[0];
+	mAlphaGroups.clear();
+	mAlphaGroups.push_back(NULL);
+	mAlphaGroupsEnd = &mAlphaGroups[0];
+	mOcclusionGroups.clear();
+	mOcclusionGroups.push_back(NULL);
+	mOcclusionGroupsEnd = &mOcclusionGroups[0];
+	mDrawableGroups.clear();
+	mDrawableGroups.push_back(NULL);
+	mDrawableGroupsEnd = &mDrawableGroups[0];
+	mVisibleList.clear();
+	mVisibleList.push_back(NULL);
+	mVisibleListEnd = &mVisibleList[0];
+	mVisibleBridge.clear();
+	mVisibleBridge.push_back(NULL);
+	mVisibleBridgeEnd = &mVisibleBridge[0];
 
 	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
 	{
-		mRenderMap[i] = NULL;
-		mRenderMapEnd[i] = NULL;
+		mRenderMap[i].clear();
+		mRenderMap[i].push_back(NULL);
+		mRenderMapEnd[i] = &mRenderMap[i][0];
 		mRenderMapAllocated[i] = 0;
 	}
 
 	clear();
 }
 
-void LLCullResult::pushBack(void**& head, U32& count, void* val)
+template <class T, class V> 
+void LLCullResult::pushBack(T& head, U32& count, V* val)
 {
+	head[count] = val;
+	head.push_back(NULL);
 	count++;
-	head = (void**) realloc((void*) head, sizeof(void*) * count);
-	head[count-1] = val;
 }
 
 void LLCullResult::clear()
 {
 	mVisibleGroupsSize = 0;
-	mVisibleGroupsEnd = mVisibleGroups;
+	mVisibleGroupsEnd = &mVisibleGroups[0];
 
 	mAlphaGroupsSize = 0;
-	mAlphaGroupsEnd = mAlphaGroups;
+	mAlphaGroupsEnd = &mAlphaGroups[0];
 
 	mOcclusionGroupsSize = 0;
-	mOcclusionGroupsEnd = mOcclusionGroups;
+	mOcclusionGroupsEnd = &mOcclusionGroups[0];
 
 	mDrawableGroupsSize = 0;
-	mDrawableGroupsEnd = mDrawableGroups;
+	mDrawableGroupsEnd = &mDrawableGroups[0];
 
 	mVisibleListSize = 0;
-	mVisibleListEnd = mVisibleList;
+	mVisibleListEnd = &mVisibleList[0];
 
 	mVisibleBridgeSize = 0;
-	mVisibleBridgeEnd = mVisibleBridge;
+	mVisibleBridgeEnd = &mVisibleBridge[0];
 
 
 	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
@@ -4771,13 +4779,13 @@ void LLCullResult::clear()
 			mRenderMap[i][j] = 0;
 		}
 		mRenderMapSize[i] = 0;
-		mRenderMapEnd[i] = mRenderMap[i];
+		mRenderMapEnd[i] = &(mRenderMap[i][0]);
 	}
 }
 
 LLCullResult::sg_iterator LLCullResult::beginVisibleGroups()
 {
-	return mVisibleGroups;
+	return &mVisibleGroups[0];
 }
 
 LLCullResult::sg_iterator LLCullResult::endVisibleGroups()
@@ -4787,7 +4795,7 @@ LLCullResult::sg_iterator LLCullResult::endVisibleGroups()
 
 LLCullResult::sg_iterator LLCullResult::beginAlphaGroups()
 {
-	return mAlphaGroups;
+	return &mAlphaGroups[0];
 }
 
 LLCullResult::sg_iterator LLCullResult::endAlphaGroups()
@@ -4797,7 +4805,7 @@ LLCullResult::sg_iterator LLCullResult::endAlphaGroups()
 
 LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups()
 {
-	return mOcclusionGroups;
+	return &mOcclusionGroups[0];
 }
 
 LLCullResult::sg_iterator LLCullResult::endOcclusionGroups()
@@ -4807,7 +4815,7 @@ LLCullResult::sg_iterator LLCullResult::endOcclusionGroups()
 
 LLCullResult::sg_iterator LLCullResult::beginDrawableGroups()
 {
-	return mDrawableGroups;
+	return &mDrawableGroups[0];
 }
 
 LLCullResult::sg_iterator LLCullResult::endDrawableGroups()
@@ -4817,7 +4825,7 @@ LLCullResult::sg_iterator LLCullResult::endDrawableGroups()
 
 LLCullResult::drawable_iterator LLCullResult::beginVisibleList()
 {
-	return mVisibleList;
+	return &mVisibleList[0];
 }
 
 LLCullResult::drawable_iterator LLCullResult::endVisibleList()
@@ -4827,7 +4835,7 @@ LLCullResult::drawable_iterator LLCullResult::endVisibleList()
 
 LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge()
 {
-	return mVisibleBridge;
+	return &mVisibleBridge[0];
 }
 
 LLCullResult::bridge_iterator LLCullResult::endVisibleBridge()
@@ -4837,7 +4845,7 @@ LLCullResult::bridge_iterator LLCullResult::endVisibleBridge()
 
 LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type)
 {
-	return mRenderMap[type];
+	return &mRenderMap[type][0];
 }
 
 LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type)
@@ -4853,10 +4861,10 @@ void LLCullResult::pushVisibleGroup(LLSpatialGroup* group)
 	}
 	else
 	{
-		pushBack((void**&) mVisibleGroups, mVisibleGroupsAllocated, (void*) group);
+		pushBack(mVisibleGroups, mVisibleGroupsAllocated, group);
 	}
 	++mVisibleGroupsSize;
-	mVisibleGroupsEnd = mVisibleGroups+mVisibleGroupsSize;
+	mVisibleGroupsEnd = &mVisibleGroups[mVisibleGroupsSize];
 }
 
 void LLCullResult::pushAlphaGroup(LLSpatialGroup* group)
@@ -4867,10 +4875,10 @@ void LLCullResult::pushAlphaGroup(LLSpatialGroup* group)
 	}
 	else
 	{
-		pushBack((void**&) mAlphaGroups, mAlphaGroupsAllocated, (void*) group);
+		pushBack(mAlphaGroups, mAlphaGroupsAllocated, group);
 	}
 	++mAlphaGroupsSize;
-	mAlphaGroupsEnd = mAlphaGroups+mAlphaGroupsSize;
+	mAlphaGroupsEnd = &mAlphaGroups[mAlphaGroupsSize];
 }
 
 void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)
@@ -4881,10 +4889,10 @@ void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)
 	}
 	else
 	{
-		pushBack((void**&) mOcclusionGroups, mOcclusionGroupsAllocated, (void*) group);
+		pushBack(mOcclusionGroups, mOcclusionGroupsAllocated, group);
 	}
 	++mOcclusionGroupsSize;
-	mOcclusionGroupsEnd = mOcclusionGroups+mOcclusionGroupsSize;
+	mOcclusionGroupsEnd = &mOcclusionGroups[mOcclusionGroupsSize];
 }
 
 void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
@@ -4895,10 +4903,10 @@ void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
 	}
 	else
 	{
-		pushBack((void**&) mDrawableGroups, mDrawableGroupsAllocated, (void*) group);
+		pushBack(mDrawableGroups, mDrawableGroupsAllocated, group);
 	}
 	++mDrawableGroupsSize;
-	mDrawableGroupsEnd = mDrawableGroups+mDrawableGroupsSize;
+	mDrawableGroupsEnd = &mDrawableGroups[mDrawableGroupsSize];
 }
 
 void LLCullResult::pushDrawable(LLDrawable* drawable)
@@ -4909,10 +4917,10 @@ void LLCullResult::pushDrawable(LLDrawable* drawable)
 	}
 	else
 	{
-		pushBack((void**&) mVisibleList, mVisibleListAllocated, (void*) drawable);
+		pushBack(mVisibleList, mVisibleListAllocated, drawable);
 	}
 	++mVisibleListSize;
-	mVisibleListEnd = mVisibleList+mVisibleListSize;
+	mVisibleListEnd = &mVisibleList[mVisibleListSize];
 }
 
 void LLCullResult::pushBridge(LLSpatialBridge* bridge)
@@ -4923,10 +4931,10 @@ void LLCullResult::pushBridge(LLSpatialBridge* bridge)
 	}
 	else
 	{
-		pushBack((void**&) mVisibleBridge, mVisibleBridgeAllocated, (void*) bridge);
+		pushBack(mVisibleBridge, mVisibleBridgeAllocated, bridge);
 	}
 	++mVisibleBridgeSize;
-	mVisibleBridgeEnd = mVisibleBridge+mVisibleBridgeSize;
+	mVisibleBridgeEnd = &mVisibleBridge[mVisibleBridgeSize];
 }
 
 void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)
@@ -4937,10 +4945,10 @@ void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)
 	}
 	else
 	{
-		pushBack((void**&) mRenderMap[type], mRenderMapAllocated[type], (void*) draw_info);
+		pushBack(mRenderMap[type], mRenderMapAllocated[type], draw_info);
 	}
 	++mRenderMapSize[type];
-	mRenderMapEnd[type] = mRenderMap[type] + mRenderMapSize[type];
+	mRenderMapEnd[type] = &(mRenderMap[type][mRenderMapSize[type]]);
 }
 
 
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index e63037b4a8..b1706d9d35 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -569,10 +569,10 @@ class LLCullResult
 public:
 	LLCullResult();
 
-	typedef LLSpatialGroup** sg_list_t;
-	typedef LLDrawable** drawable_list_t;
-	typedef LLSpatialBridge** bridge_list_t;
-	typedef LLDrawInfo** drawinfo_list_t;
+	typedef std::vector<LLSpatialGroup*> sg_list_t;
+	typedef std::vector<LLDrawable*> drawable_list_t;
+	typedef std::vector<LLSpatialBridge*> bridge_list_t;
+	typedef std::vector<LLDrawInfo*> drawinfo_list_t;
 
 	typedef LLSpatialGroup** sg_iterator;
 	typedef LLSpatialBridge** bridge_iterator;
@@ -622,7 +622,7 @@ public:
 
 private:
 
-	void pushBack(void** &head, U32& count, void* val);
+	template <class T, class V> void pushBack(T &head, U32& count, V* val);
 
 	U32					mVisibleGroupsSize;
 	U32					mAlphaGroupsSize;
-- 
cgit v1.2.3


From 57e8f8f5e4f771d6fe6a7739db474ade24af71e8 Mon Sep 17 00:00:00 2001
From: callumprentice <none@none>
Date: Thu, 11 Oct 2012 16:51:56 -0700
Subject: point to new version of Google Breakpad and tweak function sig of GBP
 exception handler

---
 indra/llcommon/llapp.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index ed192a9975..a93957bb6b 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -349,7 +349,12 @@ void LLApp::setupErrorHandling()
 	if(installHandler && (mExceptionHandler == 0))
 	{
 		std::string dumpPath = "/tmp/";
-		mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true);
+		mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 
+																  0,
+																  &unix_post_minidump_callback,
+																  0,
+																  true,
+																  "port_name");
 	}
 #endif
 
-- 
cgit v1.2.3


From a64e0b3e25a13fa8f8f5828da8f029dea2197e6f Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Mon, 15 Oct 2012 14:08:27 -0700
Subject: changed ctor param to use in-process crash generation

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

(limited to 'indra')

diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index a93957bb6b..95ea60b005 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -354,7 +354,7 @@ void LLApp::setupErrorHandling()
 																  &unix_post_minidump_callback,
 																  0,
 																  true,
-																  "port_name");
+																  NULL);
 	}
 #endif
 
-- 
cgit v1.2.3


From c8d58f8db33360a0610a6dabd29916b4081a73db Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Wed, 17 Oct 2012 13:51:53 -0700
Subject: Update script that generates Google Breakpad symbols to look in tghe
 right place first and default to the original location if not found.

---
 indra/newview/generate_breakpad_symbols.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py
index 5ebec1563e..ddc8a41136 100644
--- a/indra/newview/generate_breakpad_symbols.py
+++ b/indra/newview/generate_breakpad_symbols.py
@@ -75,7 +75,14 @@ def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, vi
 
     def dump_module(m):
         print "dumping module '%s' with '%s'..." % (m, dump_syms_tool)
-        child = subprocess.Popen([dump_syms_tool, m] , stdout=subprocess.PIPE)
+        dsym_full_path = m
+        if sys.platform in ['darwin']:
+            dsym_dir=os.path.join(m+".dSYM", 'Contents', 'Resources', 'DWARF')
+            if os.path.isdir(dsym_dir):
+                dsym_full_path=os.path.join(dsym_dir, os.path.basename(m))
+            else:
+                dsym_full_path = m
+        child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE)
         out, err = child.communicate()
         return (m,child.returncode, out, err)
 
-- 
cgit v1.2.3


From 5bf755ba014cfd8f82b2b94f29ace98a8e887ed6 Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Wed, 17 Oct 2012 17:11:13 -0700
Subject: Adding '-g' to mac builds

---
 indra/cmake/00-Common.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 98eeed09b3..bc140d5f7c 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -195,7 +195,7 @@ if (DARWIN)
   # This is a known issue where getcontext(3) is writing past the end of the
   # ucontext_t struct when _XOPEN_SOURCE is not defined (rdar://problem/5578699 ).
   # As a workaround, define _XOPEN_SOURCE before including ucontext.h.
-  add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
+  add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE -g)
   set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
   set(DARWIN_extra_cstar_flags "-mlong-branch")
-- 
cgit v1.2.3


From 4936ce7782a22ec27239bba27d6fd18ae0bfa1a0 Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Thu, 18 Oct 2012 16:23:31 -0700
Subject: Removing -g flag from mac builds

---
 indra/cmake/00-Common.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index bc140d5f7c..98eeed09b3 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -195,7 +195,7 @@ if (DARWIN)
   # This is a known issue where getcontext(3) is writing past the end of the
   # ucontext_t struct when _XOPEN_SOURCE is not defined (rdar://problem/5578699 ).
   # As a workaround, define _XOPEN_SOURCE before including ucontext.h.
-  add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE -g)
+  add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
   set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
   set(DARWIN_extra_cstar_flags "-mlong-branch")
-- 
cgit v1.2.3


From 73cc2c6a7ab853b79e12d215060936fec7bf036d Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Sat, 20 Oct 2012 09:46:59 +0000
Subject: Adding expanded searching for symbols during google breakpad symbol
 scan

---
 indra/newview/CMakeLists.txt               | 18 +++++++---
 indra/newview/generate_breakpad_symbols.py | 54 +++++++++++++++++++++---------
 2 files changed, 52 insertions(+), 20 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index c0a252637f..6bdcf2df25 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1987,8 +1987,9 @@ if (INSTALL)
 endif (INSTALL)
 
 if (PACKAGE)
+  set(SYMBOL_SEARCH_DIRS "")
   if (WINDOWS)
-    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
     set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-windows.tar.bz2")
     # slplugin.exe failing symbols dump - need to debug, might have to do with updated version of google breakpad
     # set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX} slplugin.exe")
@@ -1997,13 +1998,20 @@ if (PACKAGE)
     set(VIEWER_COPY_MANIFEST copy_w_viewer_manifest)
   endif (WINDOWS)
   if (DARWIN)
-    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
+    # *TODO: Generate these search dirs in the cmake files related to each binary.
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/llplugin/slplugin/${CMAKE_CFG_INTDIR}")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_crash_logger/${CMAKE_CFG_INTDIR}")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_updater/${CMAKE_CFG_INTDIR}")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/gstreamer010/${CMAKE_CFG_INTDIR}")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}")
     set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2")
-    set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin")
+    set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin mac-updater mac-crash-logger")
     set(VIEWER_LIB_GLOB "*.dylib")
   endif (DARWIN)
   if (LINUX)
-    set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/packaged")
+    list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/packaged")
     set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-linux.tar.bz2")
     set(VIEWER_EXE_GLOBS "do-not-directly-run-secondlife-bin SLPlugin")
     set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}*")
@@ -2023,7 +2031,7 @@ if (PACKAGE)
     ARGS
       "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py"
       "${LLBUILD_CONFIG}"
-      "${VIEWER_DIST_DIR}"
+      "${SYMBOL_SEARCH_DIRS}"
       "${VIEWER_EXE_GLOBS}"
       "${VIEWER_LIB_GLOB}"
       "${AUTOBUILD_INSTALL_DIR}/bin/dump_syms"
diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py
index ddc8a41136..4181e4ebb3 100644
--- a/indra/newview/generate_breakpad_symbols.py
+++ b/indra/newview/generate_breakpad_symbols.py
@@ -39,17 +39,20 @@ import shlex
 import subprocess
 import tarfile
 import StringIO
+import pprint
+
+DEBUG=False
 
 def usage():
-    print >>sys.stderr, "usage: %s viewer_dir viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0]
+    print >>sys.stderr, "usage: %s search_dirs viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0]
 
 class MissingModuleError(Exception):
     def __init__(self, modules):
         Exception.__init__(self, "Failed to find required modules: %r" % modules)
         self.modules = modules
 
-def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file):
-    print "generate_breakpad_symbols run with args: %s" % str((configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file))
+def main(configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file):
+    print "generate_breakpad_symbols run with args: %s" % str((configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file))
 
     if not re.match("release", configuration, re.IGNORECASE):
         print "skipping breakpad symbol generation for non-release build."
@@ -67,28 +70,49 @@ def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, vi
             return True
         return fnmatch.fnmatch(f, libs_suffix)
 
+    search_dirs = search_dirs.split(";")
+
     def list_files():
-        for (dirname, subdirs, filenames) in os.walk(viewer_dir):
-            #print "scanning '%s' for modules..." % dirname
-            for f in itertools.ifilter(matches, filenames):
-                yield os.path.join(dirname, f)
+        for search_dir in search_dirs:
+            for (dirname, subdirs, filenames) in os.walk(search_dir):
+                if DEBUG:
+                    print "scanning '%s' for modules..." % dirname
+                for f in itertools.ifilter(matches, filenames):
+                    yield os.path.join(dirname, f)
 
     def dump_module(m):
         print "dumping module '%s' with '%s'..." % (m, dump_syms_tool)
         dsym_full_path = m
-        if sys.platform in ['darwin']:
-            dsym_dir=os.path.join(m+".dSYM", 'Contents', 'Resources', 'DWARF')
-            if os.path.isdir(dsym_dir):
-                dsym_full_path=os.path.join(dsym_dir, os.path.basename(m))
-            else:
-                dsym_full_path = m
         child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE)
         out, err = child.communicate()
         return (m,child.returncode, out, err)
 
-    out = tarfile.open(viewer_symbol_file, 'w:bz2')
+    
+    modules = {}
+        
+    for m in list_files():
+        if DEBUG:
+            print "examining module '%s' ... " % m,
+        filename=os.path.basename(m)
+        if -1 != m.find("DWARF"):
+            # Just use this module; it has the symbols we want.
+            modules[filename] = m
+            if DEBUG:
+                print "found dSYM entry"
+        elif filename not in modules:
+            # Only use this if we don't already have a (possibly better) entry.
+            modules[filename] = m
+            if DEBUG:
+                print "found new entry"
+        elif DEBUG:
+            print "ignoring entry"
+
+
+    print "Found these following modules:"
+    pprint.pprint( modules )
 
-    for (filename,status,symbols,err) in itertools.imap(dump_module, list_files()):
+    out = tarfile.open(viewer_symbol_file, 'w:bz2')
+    for (filename,status,symbols,err) in itertools.imap(dump_module, modules.values()):
         if status == 0:
             module_line = symbols[:symbols.index('\n')]
             module_line = module_line.split()
-- 
cgit v1.2.3


From 486f80aae69ae3918c5243fdc95628071a73c4ee Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Sat, 20 Oct 2012 19:47:36 +0000
Subject: Removing build.sh darwin symbols hack.  Adding '-g' to both CFLAGS
 and CXXFLAG to have cmake generation debug symbols in xcode.

---
 indra/cmake/00-Common.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 98eeed09b3..99880a14ca 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -198,7 +198,7 @@ if (DARWIN)
   add_definitions(-DLL_DARWIN=1 -D_XOPEN_SOURCE)
   set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
-  set(DARWIN_extra_cstar_flags "-mlong-branch")
+  set(DARWIN_extra_cstar_flags "-mlong-branch -g")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  ${DARWIN_extra_cstar_flags}")
   # NOTE: it's critical that the optimization flag is put in front.
-- 
cgit v1.2.3


From ece80f722eaab4e3631094c923ee8dc5b80ab74a Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Mon, 22 Oct 2012 11:20:24 -0700
Subject: Trying original version of GBP with new scripts/code- revert
 corresponding cpp code

---
 indra/llcommon/llapp.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 95ea60b005..ed192a9975 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -349,12 +349,7 @@ void LLApp::setupErrorHandling()
 	if(installHandler && (mExceptionHandler == 0))
 	{
 		std::string dumpPath = "/tmp/";
-		mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 
-																  0,
-																  &unix_post_minidump_callback,
-																  0,
-																  true,
-																  NULL);
+		mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true);
 	}
 #endif
 
-- 
cgit v1.2.3


From 4827b7160b7629b9e3ea530df1e28134280f5e34 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 22 Oct 2012 14:39:29 -0500
Subject: Enable tcmalloc

---
 indra/cmake/GooglePerfTools.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake
index 73b3642ae6..09501e0406 100644
--- a/indra/cmake/GooglePerfTools.cmake
+++ b/indra/cmake/GooglePerfTools.cmake
@@ -3,7 +3,7 @@ include(Prebuilt)
 
 # If you want to enable or disable TCMALLOC in viewer builds, this is the place.
 # set ON or OFF as desired.
-set (USE_TCMALLOC OFF)
+set (USE_TCMALLOC ON)
 
 if (STANDALONE)
   include(FindGooglePerfTools)
-- 
cgit v1.2.3


From b8e14ad2b250ae8c4cae877035e38c485a841515 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 26 Oct 2012 15:55:58 -0500
Subject: MAINT-1709 Fix for >> that should have been > >

---
 indra/llmath/lloctree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index 68d8110f1d..4ac1e55cfc 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -78,7 +78,7 @@ public:
 
 	typedef LLOctreeTraveler<T>									oct_traveler;
 	typedef LLTreeTraveler<T>									tree_traveler;
-	typedef std::vector<LLPointer<T>>							element_list;
+	typedef std::vector<LLPointer<T> >							element_list;
 	typedef LLPointer<T>*										element_iter;
 	typedef const LLPointer<T>*									const_element_iter;
 	typedef typename std::vector<LLTreeListener<T>*>::iterator	tree_listener_iter;
-- 
cgit v1.2.3


From fb3df4790e27345a1e45f4a4675e756c1e551f21 Mon Sep 17 00:00:00 2001
From: William Todd Stinson <stinson@lindenlab.com>
Date: Tue, 30 Oct 2012 15:59:42 -0700
Subject: CHUI-459: Creating a fetchAvatarName() method for the
 LLConversationItemParticipant class to allow the class to query for the
 avatar display name directly.  Also, added a field to store the avatar name
 cache callback connection so that we can disconnect properly on object
 destruction to avoid a crash with the callback attempting to access recently
 freed memory.

---
 indra/newview/llconversationmodel.cpp  | 32 ++++++++++++++++++++++++++++++--
 indra/newview/llconversationmodel.h    | 12 +++++++++---
 indra/newview/llimfloatercontainer.cpp | 11 +----------
 indra/newview/llparticipantlist.cpp    |  3 +--
 4 files changed, 41 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 67a1aed675..33631a027b 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -369,7 +369,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display
 	LLConversationItem(display_name,uuid,root_view_model),
 	mIsMuted(false),
 	mIsModerator(false),
-	mDistToAgent(-1.0)
+	mDistToAgent(-1.0),
+	mAvatarNameCacheConnection()
 {
 	mConvType = CONV_PARTICIPANT;
 }
@@ -378,11 +379,38 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid,
 	LLConversationItem(uuid,root_view_model),
 	mIsMuted(false),
 	mIsModerator(false),
-	mDistToAgent(-1.0)
+	mDistToAgent(-1.0),
+	mAvatarNameCacheConnection()
 {
 	mConvType = CONV_PARTICIPANT;
 }
 
+LLConversationItemParticipant::~LLConversationItemParticipant()
+{
+	// Disconnect any previous avatar name cache connection to ensure
+	// that the callback method is not called after destruction
+	if (mAvatarNameCacheConnection.connected())
+	{
+		mAvatarNameCacheConnection.disconnect();
+	}
+}
+
+void LLConversationItemParticipant::fetchAvatarName()
+{
+	// Disconnect any previous avatar name cache connection
+	if (mAvatarNameCacheConnection.connected())
+	{
+		mAvatarNameCacheConnection.disconnect();
+	}
+
+	// Request the avatar name from the cache
+	llassert(getUUID().notNull());
+	if (getUUID().notNull())
+	{
+		mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2));
+	}
+}
+
 void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
     menuentry_vec_t items;
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 1d082852f5..481d46af58 100755
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -27,9 +27,11 @@
 #ifndef LL_LLCONVERSATIONMODEL_H
 #define LL_LLCONVERSATIONMODEL_H
 
+#include <boost/signals2.hpp>
+
+#include "llavatarname.h"
 #include "llfolderviewitem.h"
 #include "llfolderviewmodel.h"
-#include "llavatarname.h"
 #include "llviewerfoldertype.h"
 
 // Implementation of conversations list
@@ -177,7 +179,7 @@ class LLConversationItemParticipant : public LLConversationItem
 public:
 	LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
 	LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
-	virtual ~LLConversationItemParticipant() {}
+	virtual ~LLConversationItemParticipant();
 	
 	virtual const std::string& getDisplayName() const { return mDisplayName; }
 
@@ -189,17 +191,21 @@ public:
 	void setDistance(F64 dist) { mDistToAgent = dist; mNeedsRefresh = true; }
 
     void buildContextMenu(LLMenuGL& menu, U32 flags);
-	void onAvatarNameCache(const LLAvatarName& av_name);
 
 	virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); }
 
+	void fetchAvatarName();
+
 	void dumpDebugData();
 
 private:
+	void onAvatarNameCache(const LLAvatarName& av_name);
+
 	bool mIsMuted;		// default is false
 	bool mIsModerator;	// default is false
 	std::string mDisplayName;
 	F64  mDistToAgent;  // Distance to the agent. A negative (meaningless) value means the distance has not been set.
+	boost::signals2::connection mAvatarNameCacheConnection;
 };
 
 // We don't want to ever filter conversations but we need to declare that class to create a conversation view model.
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index f46ecd905a..00ae0b8fd8 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -358,16 +358,7 @@ void LLIMFloaterContainer::processParticipantsStyleUpdate()
 		{
 			LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
 			// Get the avatar name for this participant id from the cache and update the model
-			LLUUID participant_id = participant_model->getUUID();
-			LLAvatarName av_name;
-			LLAvatarNameCache::get(participant_id,&av_name);
-			// Avoid updating the model though if the cache is still waiting for its first update
-			if (!av_name.mDisplayName.empty())
-			{
-				participant_model->onAvatarNameCache(av_name);
-			}
-			// Bind update to the next cache name signal
-			LLAvatarNameCache::get(participant_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant_model, _2));
+			participant_model->fetchAvatarName();
 			// Next participant
 			current_participant_model++;
 		}
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index b263143bd1..e199cb5776 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -676,8 +676,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
 		LLAvatarName avatar_name;
 		bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name);
 		participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel);
-		// Binds avatar's name update callback
-		LLAvatarNameCache::get(avatar_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant, _2));
+		participant->fetchAvatarName();
 		if (mAvatarList)
 		{
 			mAvatarList->getIDs().push_back(avatar_id);
-- 
cgit v1.2.3


From ec57bd2f8e2859787b274c118fabbc19f76e04b1 Mon Sep 17 00:00:00 2001
From: William Todd Stinson <stinson@lindenlab.com>
Date: Tue, 30 Oct 2012 16:28:57 -0700
Subject: CHUI-461: Changing the default floater opacities according to Leo's
 guidelines.

---
 indra/newview/app_settings/settings.xml                         | 4 ++--
 indra/newview/skins/default/xui/en/panel_preferences_colors.xml | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 9ada5e5918..0537487ca3 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -69,7 +69,7 @@
       <key>Type</key>
       <string>F32</string>
       <key>Value</key>
-      <real>0.95</real>
+      <real>1</real>
     </map>
     <key>AdvanceSnapshot</key>
     <map>
@@ -4302,7 +4302,7 @@
       <key>Type</key>
       <string>F32</string>
       <key>Value</key>
-      <real>0.65</real>
+      <real>0.95</real>
     </map>
     <key>InBandwidth</key>
     <map>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml
index 2b22f0d6e3..9e825fe516 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml
@@ -362,7 +362,7 @@
    follows="left|top"
    height="16"
    increment="0.01"
-   initial_value="0.8"
+   initial_value="1.0"
    layout="topleft"
    label_width="115"
    label="Active:"
@@ -380,7 +380,7 @@
    follows="left|top"
    height="16"
    increment="0.01"
-   initial_value="0.5"
+   initial_value="0.95"
    layout="topleft"
    label_width="115"
    label="Inactive:"
-- 
cgit v1.2.3


From a8ca9dc5a98d0bd99581d17be45a36c602ce87fd Mon Sep 17 00:00:00 2001
From: AlexanderP ProductEngine <apaschenko@productengine.com>
Date: Wed, 31 Oct 2012 17:51:55 +0200
Subject: CHUI-374 ADD. FIX, CHUI-442 FIXED (Nearby chat is torn off and cannot
 be docked if nearby chat is received while conversation floater is closed) -
 implement. lazy creating of container

---
 indra/newview/llchicletbar.cpp         |  2 +-
 indra/newview/llimconversation.cpp     | 49 ++++++++++++++++++++++++++++++++++
 indra/newview/llimconversation.h       | 11 ++++++++
 indra/newview/llimfloater.cpp          | 34 ++---------------------
 indra/newview/llimfloater.h            |  1 -
 indra/newview/llimfloatercontainer.cpp |  8 +++---
 indra/newview/llnearbychat.cpp         | 34 ++---------------------
 indra/newview/llnearbychat.h           |  5 +---
 8 files changed, 70 insertions(+), 74 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp
index 39f5d0b8f6..3ebb83b336 100644
--- a/indra/newview/llchicletbar.cpp
+++ b/indra/newview/llchicletbar.cpp
@@ -97,7 +97,7 @@ void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& nam
 	// Do not spawn chiclet when using the new multitab conversation UI
 	if (LLIMConversation::isChatMultiTab())
 	{
-		LLIMFloater::addToHost(session_id);
+		LLIMConversation::addToHost(session_id);
 		return;
 	}
 	
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index 74bf8cb6fe..b687e18cae 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -116,6 +116,55 @@ LLIMConversation* LLIMConversation::getConversation(const LLUUID& uuid)
 	return conv;
 };
 
+void LLIMConversation::setVisible(BOOL visible)
+{
+	LLTransientDockableFloater::setVisible(visible);
+
+	if(visible)
+	{
+			LLIMConversation::addToHost(mSessionID);
+	}
+    setFocus(visible);
+}
+
+
+
+void LLIMConversation::addToHost(const LLUUID& session_id)
+{
+	if ((session_id.notNull() && !gIMMgr->hasSession(session_id))
+			|| !LLIMConversation::isChatMultiTab())
+	{
+		return;
+	}
+
+	// Get the floater: this will create the instance if it didn't exist
+	LLIMConversation* conversp = LLIMConversation::getConversation(session_id);
+	if (conversp)
+	{
+		LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
+
+		// Do not add again existing floaters
+		if (floater_container && !conversp->isHostAttached())
+		{
+			conversp->setHostAttached(true);
+
+			if (!conversp->isNearbyChat()
+					|| gSavedSettings.getBOOL("NearbyChatIsNotTornOff"))
+			{
+				floater_container->addFloater(conversp, TRUE, LLTabContainer::END);
+			}
+			else
+			{
+				// setting of the "potential" host for Nearby Chat: this sequence sets
+				// LLFloater::mHostHandle = NULL (a current host), but
+				// LLFloater::mLastHostHandle = floater_container (a "future" host)
+				conversp->setHost(floater_container);
+				conversp->setHost(NULL);
+			}
+
+		}
+	}
+}
 
 BOOL LLIMConversation::postBuild()
 {
diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h
index 603e0d0197..bff4cb4a31 100644
--- a/indra/newview/llimconversation.h
+++ b/indra/newview/llimconversation.h
@@ -59,17 +59,27 @@ public:
 	 */
 	static bool isChatMultiTab();
 
+	// add conversation to container
+	static void addToHost(const LLUUID& session_id);
+
+	bool isHostAttached() {return mIsHostAttached;}
+	void setHostAttached(bool is_attached) {mIsHostAttached = is_attached;}
+
     static LLIMConversation* findConversation(const LLUUID& uuid);
     static LLIMConversation* getConversation(const LLUUID& uuid);
 
 	// show/hide the translation check box
 	void showTranslationCheckbox(const BOOL visible = FALSE);
 
+	bool isNearbyChat() {return mIsNearbyChat;}
+
 	// LLFloater overrides
 	/*virtual*/ void onOpen(const LLSD& key);
 	/*virtual*/ void onClose(bool app_quitting);
 	/*virtual*/ BOOL postBuild();
 	/*virtual*/ void draw();
+	/*virtual*/ void setVisible(BOOL visible);
+
 
 protected:
 
@@ -139,6 +149,7 @@ private:
 	void reshapeChatHistory();
 
 	bool checkIfTornOff();
+    bool mIsHostAttached;
 
 	LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called.
 };
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 1af5def5f0..3545b8ff18 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -582,37 +582,6 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl)
 	}
 }
 
-void LLIMFloater::addToHost(const LLUUID& session_id)
-{
-	if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id))
-	{
-		return;
-	}
-
-	// Test the existence of the floater before we try to create it
-	bool exist = findInstance(session_id);
-
-	// Get the floater: this will create the instance if it didn't exist
-	LLIMFloater* floater = getInstance(session_id);
-	if (floater)
-	{
-
-		LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
-
-		// Do not add again existing floaters
-		if (!exist)
-		{
-			//		LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
-			// TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
-			LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
-			if (floater_container)
-			{
-				floater_container->addFloater(floater, FALSE, i_pt);
-			}
-		}
-	}
-}
-
 
 //static
 LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
@@ -721,7 +690,7 @@ void LLIMFloater::setVisible(BOOL visible)
 		(LLNotificationsUI::LLChannelManager::getInstance()->
 											findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
 
-	LLTransientDockableFloater::setVisible(visible);
+	LLIMConversation::setVisible(visible);
 
 	// update notification channel state
 	if(channel)
@@ -1309,6 +1278,7 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data)
 	floater->removeTypingIndicator();
 }
 
+// static
 void LLIMFloater::onIMChicletCreated( const LLUUID& session_id )
 {
 	LLIMFloater::addToHost(session_id);
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 8a0d6f10e0..6c69ed3462 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -72,7 +72,6 @@ public:
 
 	static LLIMFloater* findInstance(const LLUUID& session_id);
 	static LLIMFloater* getInstance(const LLUUID& session_id);
-	static void addToHost(const LLUUID& session_id);
 
 	// LLFloater overrides
 	/*virtual*/ void onClose(bool app_quitting);
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 00ae0b8fd8..65dc024aea 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -98,7 +98,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer()
 
 void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id)
 {
-	LLIMFloater::addToHost(session_id);
+	LLIMConversation::addToHost(session_id);
 	addConversationListItem(session_id);
 }
 
@@ -109,7 +109,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std:
 
 void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id)
 {
-	LLIMFloater::addToHost(session_id);
+	LLIMConversation::addToHost(session_id);
 	addConversationListItem(session_id);
 }
 
@@ -490,9 +490,9 @@ void LLIMFloaterContainer::setVisible(BOOL visible)
 	}
 
 	nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChat>("nearby_chat");
-	if (nearby_chat && !nearby_chat->isHostSet())
+	if (nearby_chat)
 	{
-		nearby_chat->addToHost();
+		LLIMConversation::addToHost(LLUUID());
 	}
 
 	// We need to show/hide all the associated conversations that have been torn off
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 5b274dd389..d1c7c6bfd7 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -91,8 +91,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd)
 :	LLIMConversation(llsd),
 	//mOutputMonitor(NULL),
 	mSpeakerMgr(NULL),
-	mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT),
-	mIsHostSet(false)
+	mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
 {
     mIsP2PChat = false;
 	mIsNearbyChat = true;
@@ -283,7 +282,7 @@ void LLNearbyChat::setFocus(BOOL focusFlag)
     
 }
 
-void	LLNearbyChat::setVisible(BOOL visible)
+void LLNearbyChat::setVisible(BOOL visible)
 {
 	LLIMConversation::setVisible(visible);
 
@@ -304,35 +303,6 @@ void LLNearbyChat::onTearOffClicked()
 	gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater);
 }
 
-void LLNearbyChat::addToHost()
-{
-	if ( LLIMConversation::isChatMultiTab())
-	{
-		LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
-		if (im_box)
-		{
-			if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff"))
-			{
-				im_box->addFloater(this, TRUE, LLTabContainer::END);
-			}
-			else
-			{
-				// setting of the "potential" host: this sequence sets
-				// LLFloater::mHostHandle = NULL (a current host), but
-				// LLFloater::mLastHostHandle = im_box (a "future" host)
-				setHost(im_box);
-				setHost(NULL);
-			}
-		}
-
-		mIsHostSet = true;
-	}
-	}
-
-bool LLNearbyChat::isHostSet()
-{
-    return mIsHostSet;
-}
 
 // virtual
 void LLNearbyChat::onOpen(const LLSD& key)
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index 7ada4daea8..b155fd3c26 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -53,7 +53,7 @@ public:
 	/*virtual*/ BOOL postBuild();
 	/*virtual*/ void onOpen(const LLSD& key);
     /*virtual*/ void setFocus(BOOL focusFlag);
-	/*virtual*/ void	setVisible(BOOL visible);
+	/*virtual*/ void setVisible(BOOL visible);
 
 	void loadHistory();
     void reloadMessages();
@@ -78,8 +78,6 @@ public:
 	static void startChat(const char* line);
 	static void stopChat();
 
-	bool isHostSet();
-
 	static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
 	static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
 
@@ -121,7 +119,6 @@ private:
 	LLHandle<LLView>	mPopupMenuHandle;
 	std::vector<LLChat> mMessageArchive;
 
-    bool mIsHostSet;
 };
 
 #endif
-- 
cgit v1.2.3


From d886d89f53267d9a9a02c775fcb16e667278b904 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Thu, 1 Nov 2012 15:00:50 +0200
Subject: CHUI-446 FIXED Checkm mParent before using dynamic_cast

---
 indra/newview/llconversationmodel.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 33631a027b..47a82bfe17 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -428,14 +428,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam
 	mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername);
 	mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName);
 	mNeedsRefresh = true;
-	LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
-	if (parent_session != NULL)
+	if(mParent != NULL)
 	{
-		parent_session->requestSort();
-		parent_session->updateParticipantName(this);
-		postEvent("update_participant", parent_session, this);
+		LLConversationItemSession* parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
+		if (parent_session != NULL)
+		{
+			parent_session->requestSort();
+			parent_session->updateParticipantName(this);
+			postEvent("update_participant", parent_session, this);
+		}
 	}
-
 }
 
 void LLConversationItemParticipant::dumpDebugData()
-- 
cgit v1.2.3


From 424a80155ac755bc0191ddd44ef125bdbda39fa5 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Thu, 1 Nov 2012 16:58:55 +0200
Subject: CHUI-445 FIXED Select the next conversation in the list when current
 conversation is deleted

---
 indra/newview/llimfloatercontainer.cpp | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 65dc024aea..f85aa9a353 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -1206,6 +1206,7 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c
 	// Note : since the mConversationsItems is also the listener to the widget, deleting 
 	// the widget will also delete its listener
 	bool isWidgetSelected = false;
+	LLFolderViewItem* new_selection = NULL;
 	conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid);
 	if (widget_it != mConversationsWidgets.end())
 	{
@@ -1213,6 +1214,11 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c
 		if (widget)
 		{
 			isWidgetSelected = widget->isSelected();
+			new_selection = mConversationsRoot->getNextFromChild(widget);
+			if(new_selection == NULL)
+			{
+				new_selection = mConversationsRoot->getPreviousFromChild(widget);
+			}
 			widget->destroyView();
 		}
 	}
@@ -1225,12 +1231,13 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c
 	if (change_focus)
 	{
 		setFocus(TRUE);
-		conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
-		if (widget_it != mConversationsWidgets.end())
+		if(new_selection != NULL)
 		{
-            mSelectedSession = widget_it->first;
-			LLFolderViewItem* widget = widget_it->second;
-			widget->selectItem();
+			LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
+			if(vmi != NULL)
+			{
+				selectConversation(vmi->getUUID());
+			}
 		}
 	}
 	return isWidgetSelected;
-- 
cgit v1.2.3