aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llgivemoney.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llgivemoney.cpp')
-rw-r--r--linden/indra/newview/llgivemoney.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/linden/indra/newview/llgivemoney.cpp b/linden/indra/newview/llgivemoney.cpp
index d3c7598..0baf1f3 100644
--- a/linden/indra/newview/llgivemoney.cpp
+++ b/linden/indra/newview/llgivemoney.cpp
@@ -91,6 +91,7 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
91 if (target_is_object) 91 if (target_is_object)
92 { 92 {
93 gUICtrlFactory->buildFloater(this,"floater_pay_object.xml"); 93 gUICtrlFactory->buildFloater(this,"floater_pay_object.xml");
94 mObjectSelection = gSelectMgr->getEditSelection();
94 } 95 }
95 else 96 else
96 { 97 {
@@ -166,13 +167,16 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
166 childSetAction("cancel btn",&LLFloaterPay::onCancel,this); 167 childSetAction("cancel btn",&LLFloaterPay::onCancel,this);
167 168
168 center(); 169 center();
169 open(); 170 open(); /*Flawfinder: ignore*/
170} 171}
171 172
172// Destroys the object 173// Destroys the object
173LLFloaterPay::~LLFloaterPay() 174LLFloaterPay::~LLFloaterPay()
174{ 175{
175 std::for_each(mCallbackData.begin(), mCallbackData.end(), DeletePointer()); 176 std::for_each(mCallbackData.begin(), mCallbackData.end(), DeletePointer());
177
178 // Clean up if we are still waiting for a name.
179 gCacheName->cancelCallback(mTargetUUID,onCacheOwnerName,this);
176} 180}
177 181
178// static 182// static
@@ -314,11 +318,16 @@ void LLFloaterPay::payViaObject(money_callback callback, const LLUUID& object_id
314 LLViewerObject* object = gObjectList.findObject(object_id); 318 LLViewerObject* object = gObjectList.findObject(object_id);
315 if (!object) return; 319 if (!object) return;
316 320
317 LLSelectNode* node = gSelectMgr->getFirstRootNode();
318 if (!node) return;
319
320 LLFloaterPay *floater = new LLFloaterPay("Give Money", callback, object_id, TRUE); 321 LLFloaterPay *floater = new LLFloaterPay("Give Money", callback, object_id, TRUE);
321 if (!floater) return; 322 if (!floater) return;
323
324 LLSelectNode* node = floater->mObjectSelection->getFirstRootNode();
325 if (!node)
326 {
327 //FIXME: notify user object no longer exists
328 floater->close();
329 return;
330 }
322 331
323 LLHost target_region = object->getRegion()->getHost(); 332 LLHost target_region = object->getRegion()->getHost();
324 333
@@ -361,7 +370,7 @@ void LLFloaterPay::payDirectly(money_callback callback,
361void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group) 370void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group)
362{ 371{
363 gCacheName->get(target_id, is_group, onCacheOwnerName, (void*)this); 372 gCacheName->get(target_id, is_group, onCacheOwnerName, (void*)this);
364 373
365 // Make sure the amount field has focus 374 // Make sure the amount field has focus
366 375
367 childSetFocus("amount", TRUE); 376 childSetFocus("amount", TRUE);
@@ -402,10 +411,6 @@ void LLFloaterPay::onCancel(void* data)
402 LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data); 411 LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data);
403 if(self) 412 if(self)
404 { 413 {
405 if (self->mTargetIsObject)
406 {
407 gSelectMgr->deselectAll();
408 }
409 self->close(); 414 self->close();
410 } 415 }
411} 416}
@@ -460,7 +465,7 @@ void LLFloaterPay::give(S32 amount)
460 if (region) 465 if (region)
461 { 466 {
462 // Find the name of the root object 467 // Find the name of the root object
463 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 468 LLSelectNode* node = mObjectSelection->getFirstRootNode();
464 LLString object_name; 469 LLString object_name;
465 if (node) 470 if (node)
466 { 471 {
@@ -469,7 +474,7 @@ void LLFloaterPay::give(S32 amount)
469 S32 tx_type = TRANS_PAY_OBJECT; 474 S32 tx_type = TRANS_PAY_OBJECT;
470 if(dest_object->isAvatar()) tx_type = TRANS_GIFT; 475 if(dest_object->isAvatar()) tx_type = TRANS_GIFT;
471 mCallback(mTargetUUID, region, amount, FALSE, tx_type, object_name); 476 mCallback(mTargetUUID, region, amount, FALSE, tx_type, object_name);
472 gSelectMgr->deselectAll(); 477 mObjectSelection = NULL;
473 } 478 }
474 } 479 }
475 } 480 }