From 4093d5b1ebe6b0eb50473d5161042ac3a1b7f6b2 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 4 Jan 2023 15:13:02 -0500
Subject: [PATCH] DRTVWR-575: Use llsdutil.h functions for
 LLFloaterLandHoldings LLSD

LLFloaterLandHoldings::postBuild() was constructing an LLSD structure by
assigning each map entry and array element one at a time. Chorazinallen
identified a crash bug possibly caused by destroying that LLSD structure.
Diagnostically try building it using nested llsd::map() and llsd::array()
calls instead to see if that improves matters.
---
 indra/newview/llfloaterlandholdings.cpp | 32 +++++++++++++------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp
index 8633fe4e5e5..a3222d622fe 100644
--- a/indra/newview/llfloaterlandholdings.cpp
+++ b/indra/newview/llfloaterlandholdings.cpp
@@ -39,6 +39,7 @@
 #include "llfloaterworldmap.h"
 #include "llproductinforequest.h"
 #include "llscrolllistctrl.h"
+#include "llsdutil.h"
 #include "llstatusbar.h"
 #include "lltextbox.h"
 #include "llscrolllistctrl.h"
@@ -79,24 +80,25 @@ BOOL LLFloaterLandHoldings::postBuild()
 	for(S32 i = 0; i < count; ++i)
 	{
 		LLUUID id(gAgent.mGroups.at(i).mID);
-
-		LLSD element;
-		element["id"] = id;
-		element["columns"][0]["column"] = "group";
-		element["columns"][0]["value"] = gAgent.mGroups.at(i).mName;
-		element["columns"][0]["font"] = "SANSSERIF";
-
 		LLUIString areastr = getString("area_string");
 		areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution));
-		element["columns"][1]["column"] = "area";
-		element["columns"][1]["value"] = areastr;
-		element["columns"][1]["font"] = "SANSSERIF";
 
-		grant_list->addElement(element);
+		grant_list->addElement(
+			llsd::map(
+				"id", id,
+				"columns", llsd::array(
+					llsd::map(
+						"column", "group",
+						"value", gAgent.mGroups.at(i).mName,
+						"font", "SANSSERIF"),
+					llsd::map(
+						"column", "area",
+						"value", areastr,
+						"font", "SANSSERIF"))));
 	}
-	
+
 	center();
-	
+
 	return TRUE;
 }
 
@@ -108,8 +110,8 @@ LLFloaterLandHoldings::~LLFloaterLandHoldings()
 
 void LLFloaterLandHoldings::onOpen(const LLSD& key)
 {
-    LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
-    list->clearRows();
+	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
+	list->clearRows();
 
 	// query_id null is known to be us
 	const LLUUID& query_id = LLUUID::null;
-- 
GitLab