From 7f97aa2d5db0d1429136a40d04d2e4428cb184fe Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 25 Oct 2012 17:30:03 -0700
Subject: [PATCH] SH-3405 WIP convert existing stats to lltrace system fixed
 crash on exit

---
 indra/llcommon/llinitparam.h | 13 -------------
 indra/llui/llxuiparser.cpp   | 10 +++++++++-
 indra/llxml/llxmlnode.cpp    |  3 ++-
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h
index a3a5b3dc372..9530e562f6d 100644
--- a/indra/llcommon/llinitparam.h
+++ b/indra/llcommon/llinitparam.h
@@ -916,7 +916,6 @@ namespace LLInitParam
 			{
 				predicate.add(NON_DEFAULT);
 			}
-			predicate.unknown(REQUIRED);
 			if (typed_param.isValid())
 			{
 				predicate.add(VALID);
@@ -1074,8 +1073,6 @@ namespace LLInitParam
 			const self_t& typed_param = static_cast<const self_t&>(param);
 
 			LLPredicate::Value<ESerializePredicates> predicate;
-			predicate.unknown(NON_DEFAULT);
-			predicate.unknown(REQUIRED);
 
 			if (typed_param.isValid())
 			{
@@ -1272,16 +1269,11 @@ namespace LLInitParam
 			const self_t& typed_param = static_cast<const self_t&>(param);
 			
 			LLPredicate::Value<ESerializePredicates> predicate;
-			predicate.unknown(NON_DEFAULT);
 
 			if (typed_param.mMinCount > 0)
 			{
 				predicate.add(REQUIRED);
 			}
-			else
-			{
-				predicate.unknown(REQUIRED);
-			}
 
 			if (typed_param.isValid())
 			{
@@ -1538,16 +1530,11 @@ namespace LLInitParam
 			const self_t& typed_param = static_cast<const self_t&>(param);
 
 			LLPredicate::Value<ESerializePredicates> predicate;
-			predicate.unknown(NON_DEFAULT);
 
 			if (typed_param.mMinCount > 0)
 			{
 				predicate.add(REQUIRED);
 			}
-			else
-			{
-				predicate.unknown(REQUIRED);
-			}
 
 			if (typed_param.isValid())
 			{
diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp
index 179a1184af0..95cda926329 100644
--- a/indra/llui/llxuiparser.cpp
+++ b/indra/llui/llxuiparser.cpp
@@ -880,16 +880,24 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack)
 		it = next_it)
 	{
 		++next_it;
+		bool force_new_node = false;
+
 		if (it->first.empty())
 		{
 			it->second = false;
 			continue;
 		}
 
+		if (next_it != stack.end() && next_it->first.empty() && next_it->second)
+		{
+			force_new_node = true;
+		}
+
+
 		out_nodes_t::iterator found_it = mOutNodes.find(it->first);
 
 		// node with this name not yet written
-		if (found_it == mOutNodes.end() || it->second)
+		if (found_it == mOutNodes.end() || it->second || force_new_node)
 		{
 			// make an attribute if we are the last element on the name stack
 			bool is_attribute = next_it == stack.end();
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 2ffb0d8503c..8746114f1b9 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -273,7 +273,8 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child)
 	new_child->mParent = this;
 	if (new_child->mIsAttribute)
 	{
-		mAttributes.insert(std::make_pair(new_child->mName, new_child));
+		std::pair<LLXMLAttribList::iterator, bool> result = mAttributes.insert(std::make_pair(new_child->mName, new_child));
+		llassert(result.second);
 	}
 	else
 	{
-- 
GitLab