Commits

Kelly Washington committed 2d89427 Draft

MAINT-1748 Users have an ability to sell non existing objects from content of other object
* Keep the buy-contents floater subscribed to inventory changes on the object.
reviewed with Simon

Comments (0)

Files changed (1)

indra/newview/llfloaterbuycontents.cpp

 
 LLFloaterBuyContents::~LLFloaterBuyContents()
 {
+	removeVOInventoryListener();
 }
 
 
 		return;
 	}
 
-	if (!inv)
-	{
-		llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged"
-			<< llendl;
-		removeVOInventoryListener();
-		return;
-	}
-
-	LLCtrlListInterface *item_list = childGetListInterface("item_list");
+	LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
 	if (!item_list)
 	{
 		removeVOInventoryListener();
 		return;
 	}
 
+	item_list->deleteAllItems();
+	
+	if (!inv)
+	{
+		llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged"
+			<< llendl;
+
+		return;
+	}
+
 	// default to turning off the buy button.
-	getChildView("buy_btn")->setEnabled(FALSE);
+	LLView* buy_btn = getChildView("buy_btn");
+	buy_btn->setEnabled(FALSE);
 
 	LLUUID owner_id;
 	BOOL is_group_owned;
 
 		// There will be at least one item shown in the display, so go
 		// ahead and enable the buy button.
-		getChildView("buy_btn")->setEnabled(TRUE);
+		buy_btn->setEnabled(TRUE);
 
 		// Create the line in the list
 		LLSD row;
 		getChildView("wear_check")->setEnabled(TRUE);
 		getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) );
 	}
-	
-	removeVOInventoryListener();
 }