diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index bca4b5e447..fffd724b22 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -80,6 +80,7 @@ BOOL LLFloaterBuyContents::postBuild() LLFloaterBuyContents::~LLFloaterBuyContents() { + removeVOInventoryListener(); } @@ -147,23 +148,26 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, return; } - if (!inv) - { - llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged" - << llendl; - removeVOInventoryListener(); - return; - } - - LLCtrlListInterface *item_list = childGetListInterface("item_list"); + LLScrollListCtrl* item_list = getChild("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; @@ -204,7 +208,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, // 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; @@ -255,8 +259,6 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, getChildView("wear_check")->setEnabled(TRUE); getChild("wear_check")->setValue(LLSD(false) ); } - - removeVOInventoryListener(); }