From 27fc270c73fdf3db5c07e9ed43b7f4d0994b2cc2 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Tue, 18 Jun 2013 16:51:37 -0400
Subject: [PATCH] SH-4262 WIP - fix for the reordering bug in AIS regions.

---
 indra/newview/llaisapi.cpp          | 7 +++++++
 indra/newview/llappearancemgr.cpp   | 5 +++++
 indra/newview/llviewerinventory.cpp | 3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 393e5c0a68e..aad12a9cc9c 100755
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -326,6 +326,12 @@ void AISUpdate::parseUpdate(const LLSD& update)
 	{
 		LLUUID item_id = update["item_id"].asUUID();
 		LLPointer<LLViewerInventoryItem> new_item(new LLViewerInventoryItem);
+		LLViewerInventoryItem *curr_item = gInventory.getItem(item_id);
+		if (curr_item)
+		{
+			// Default to current values where not provided.
+			new_item->copyViewerItem(curr_item);
+		}
 		BOOL rv = new_item->unpackMessage(update);
 		if (rv)
 		{
@@ -468,6 +474,7 @@ void AISUpdate::doUpdate()
 		// cases.  Maybe break out the update/create cases, in which
 		// case this is update.
 		LL_DEBUGS("Inventory") << "updated item " << item_id << llendl;
+		//LL_DEBUGS("Inventory") << ll_pretty_print_sd(new_item->asLLSD()) << llendl;
 		gInventory.updateItem(new_item);
 	}
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index f5f6faf6b69..16552f00821 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -3434,7 +3434,12 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b
 	swap_item->setDescription(item->getActualDescription());
 	item->setDescription(tmp);
 
+	// LL_DEBUGS("Inventory") << "swap, item "
+	// 					   << ll_pretty_print_sd(item->asLLSD())
+	// 					   << " swap_item "
+	// 					   << ll_pretty_print_sd(swap_item->asLLSD()) << llendl;
 
+	// FIXME switch to use AISv3 where supported.
 	//items need to be updated on a dataserver
 	item->setComplete(TRUE);
 	item->updateServer(FALSE);
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 55575764b90..26aecd39d14 100755
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -360,7 +360,8 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const
 	if(gAgent.getID() != mPermissions.getOwner())
 	{
 		// *FIX: deal with this better.
-		llwarns << "LLViewerInventoryItem::updateServer() - for unowned item"
+		llwarns << "LLViewerInventoryItem::updateServer() - for unowned item "
+			    << ll_pretty_print_sd(this->asLLSD())
 				<< llendl;
 		return;
 	}
-- 
GitLab