EXT-8124 FIXED Avoided saving processed notifications that spawns script floater.
Details: 1 Avoided memory leak in LLScriptFloaterManager caused not destroying processed notifications. 2 Provided destroying notification if user initiate closing script floater and not destroying if viewer exit. reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/721/ --HG-- branch : product-engine
parent
50e6e5e49b
commit
4f6badf216
|
|
@ -1886,7 +1886,7 @@ void LLScriptChiclet::onMenuItemClicked(const LLSD& user_data)
|
|||
|
||||
if("end" == action)
|
||||
{
|
||||
LLScriptFloaterManager::instance().onRemoveNotification(getSessionId());
|
||||
LLScriptFloaterManager::instance().removeNotification(getSessionId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1969,7 +1969,7 @@ void LLInvOfferChiclet::onMenuItemClicked(const LLSD& user_data)
|
|||
|
||||
if("end" == action)
|
||||
{
|
||||
LLScriptFloaterManager::instance().onRemoveNotification(getSessionId());
|
||||
LLScriptFloaterManager::instance().removeNotification(getSessionId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,15 @@ void LLScriptFloater::onClose(bool app_quitting)
|
|||
|
||||
if(getNotificationId().notNull())
|
||||
{
|
||||
LLScriptFloaterManager::getInstance()->onRemoveNotification(getNotificationId());
|
||||
// we shouldn't kill notification on exit since it may be used as persistent.
|
||||
if (app_quitting)
|
||||
{
|
||||
LLScriptFloaterManager::getInstance()->onRemoveNotification(getNotificationId());
|
||||
}
|
||||
else
|
||||
{
|
||||
LLScriptFloaterManager::getInstance()->removeNotification(getNotificationId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +360,7 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id)
|
|||
set_new_message |= !floater->hasFocus();
|
||||
}
|
||||
|
||||
onRemoveNotification(it->first);
|
||||
removeNotification(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -379,6 +387,17 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id)
|
|||
toggleScriptFloater(notification_id, set_new_message);
|
||||
}
|
||||
|
||||
void LLScriptFloaterManager::removeNotification(const LLUUID& notification_id)
|
||||
{
|
||||
LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
|
||||
if (notification != NULL && !notification->isCancelled())
|
||||
{
|
||||
LLNotificationsUtil::cancel(notification);
|
||||
}
|
||||
|
||||
onRemoveNotification(notification_id);
|
||||
}
|
||||
|
||||
void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
|
||||
{
|
||||
if(notification_id.isNull())
|
||||
|
|
@ -392,6 +411,8 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
|
|||
|
||||
LLIMWellWindow::getInstance()->removeObjectRow(notification_id);
|
||||
|
||||
mNotifications.erase(notification_id);
|
||||
|
||||
// close floater
|
||||
LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", notification_id);
|
||||
if(floater)
|
||||
|
|
@ -400,8 +421,6 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
|
|||
floater->setNotificationId(LLUUID::null);
|
||||
floater->closeFloater();
|
||||
}
|
||||
|
||||
mNotifications.erase(notification_id);
|
||||
}
|
||||
|
||||
void LLScriptFloaterManager::toggleScriptFloater(const LLUUID& notification_id, bool set_new_message)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ public:
|
|||
*/
|
||||
void onAddNotification(const LLUUID& notification_id);
|
||||
|
||||
/**
|
||||
* Removes notification.
|
||||
*/
|
||||
void removeNotification(const LLUUID& notification_id);
|
||||
|
||||
/**
|
||||
* Handles notification removal.
|
||||
* Removes script notification toast, removes script chiclet, closes script floater
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ LLIMWellWindow::ObjectRowPanel::~ObjectRowPanel()
|
|||
//---------------------------------------------------------------------------------
|
||||
void LLIMWellWindow::ObjectRowPanel::onClosePanel()
|
||||
{
|
||||
LLScriptFloaterManager::getInstance()->onRemoveNotification(mChiclet->getSessionId());
|
||||
LLScriptFloaterManager::getInstance()->removeNotification(mChiclet->getSessionId());
|
||||
}
|
||||
|
||||
void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id, bool new_message/* = false*/)
|
||||
|
|
@ -832,7 +832,7 @@ void LLIMWellWindow::closeAllImpl()
|
|||
ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel);
|
||||
if (obj_panel)
|
||||
{
|
||||
LLScriptFloaterManager::instance().onRemoveNotification(*iter);
|
||||
LLScriptFloaterManager::instance().removeNotification(*iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue