summaryrefslogtreecommitdiff
path: root/indra/newview/lltoast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoast.cpp')
-rwxr-xr-xindra/newview/lltoast.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 9dfb29b905..d876c9a3f4 100755
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -173,8 +173,20 @@ void LLToast::setHideButtonEnabled(bool enabled)
//--------------------------------------------------------------------------
LLToast::~LLToast()
-{
- mOnToastDestroyedSignal(this);
+{
+ if(LLApp::isQuitting())
+ {
+ mOnFadeSignal.disconnect_all_slots();
+ mOnDeleteToastSignal.disconnect_all_slots();
+ mOnToastDestroyedSignal.disconnect_all_slots();
+ mOnToastHoverSignal.disconnect_all_slots();
+ mToastMouseEnterSignal.disconnect_all_slots();
+ mToastMouseLeaveSignal.disconnect_all_slots();
+ }
+ else
+ {
+ mOnToastDestroyedSignal(this);
+ }
}
//--------------------------------------------------------------------------
@@ -572,10 +584,34 @@ S32 LLToast::notifyParent(const LLSD& info)
//static
void LLToast::updateClass()
{
- for (LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances(); iter != LLInstanceTracker<LLToast>::endInstances(); )
+ for (LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances();
+ iter != LLInstanceTracker<LLToast>::endInstances(); )
{
LLToast& toast = *iter++;
toast.updateHoveredState();
}
}
+
+// static
+void LLToast::cleanupToasts()
+{
+ LLToast * toastp = NULL;
+
+ while (LLInstanceTracker<LLToast>::instanceCount() > 0)
+ {
+ { // Need to scope iter to allow deletion
+ LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances();
+ toastp = &(*iter);
+ }
+
+ //llinfos << "Cleaning up toast id " << toastp->getNotificationID() << llendl;
+
+ // LLToast destructor will remove it from the LLInstanceTracker.
+ if (!toastp)
+ break; // Don't get stuck in the loop if a null pointer somehow got on the list
+
+ delete toastp;
+ }
+}
+