EXT-1651 Fix "You cannot close the Buy Land window" error message that prevents buying land more than once per login session.

Made LLFloaterBuyLandUI destroy itself on close, which cleans up pending currency transactions.
Changed LLViewerParcelMgr::deleteBuyInfo() signature because I found it confusing.
Reviewed with Richard.
master
James Cook 2009-10-22 12:15:53 -07:00
parent f58857824e
commit a464d46970
3 changed files with 19 additions and 6 deletions

View File

@ -81,6 +81,8 @@ public:
LLFloaterBuyLandUI(const LLSD& key);
virtual ~LLFloaterBuyLandUI();
/*virtual*/ void onClose(bool app_quitting);
private:
class SelectionObserver : public LLParcelObserver
{
@ -300,11 +302,21 @@ LLFloaterBuyLandUI::LLFloaterBuyLandUI(const LLSD& key)
LLFloaterBuyLandUI::~LLFloaterBuyLandUI()
{
LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver);
LLViewerParcelMgr::getInstance()->deleteParcelBuy(mParcelBuyInfo);
LLViewerParcelMgr::getInstance()->deleteParcelBuy(&mParcelBuyInfo);
delete mTransaction;
}
// virtual
void LLFloaterBuyLandUI::onClose(bool app_quitting)
{
// This object holds onto observer, transactions, and parcel state.
// Despite being single_instance, destroy it to call destructors and clean
// everything up.
setVisible(FALSE);
destroy();
}
void LLFloaterBuyLandUI::SelectionObserver::changed()
{
if (LLViewerParcelMgr::getInstance()->selectionEmpty())
@ -756,7 +768,7 @@ void LLFloaterBuyLandUI::sendBuyLand()
if (mParcelBuyInfo)
{
LLViewerParcelMgr::getInstance()->sendParcelBuy(mParcelBuyInfo);
LLViewerParcelMgr::getInstance()->deleteParcelBuy(mParcelBuyInfo);
LLViewerParcelMgr::getInstance()->deleteParcelBuy(&mParcelBuyInfo);
mBought = true;
}
}

View File

@ -1162,10 +1162,11 @@ void LLViewerParcelMgr::sendParcelBuy(ParcelBuyInfo* info)
msg->sendReliable(info->mHost);
}
void LLViewerParcelMgr::deleteParcelBuy(ParcelBuyInfo*& info)
void LLViewerParcelMgr::deleteParcelBuy(ParcelBuyInfo* *info)
{
delete info;
info = NULL;
// Must be here because ParcelBuyInfo is local to this .cpp file
delete *info;
*info = NULL;
}
void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)

View File

@ -246,7 +246,7 @@ public:
BOOL remove_contribution);
// callers responsibility to call deleteParcelBuy() on return value
void sendParcelBuy(ParcelBuyInfo*);
void deleteParcelBuy(ParcelBuyInfo*&);
void deleteParcelBuy(ParcelBuyInfo* *info);
void sendParcelDeed(const LLUUID& group_id);