summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychathandler.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-16 23:53:41 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-16 23:53:41 +0300
commit26940eb2ffcc91d5fd1a825a9638d0f8fff2b9ae (patch)
treee5423afc9ce528e49f896746d4aa65513ee68901 /indra/newview/llnearbychathandler.cpp
parent7f6d49df43c660b9f5632ffb8a30f90ee718cac0 (diff)
STORM-1352 WIP Attempting to fix a crash in LLNearbyChatScreenChannel::showToastsBottom().
Apparently, a nearby chat toast got somehow destroyed while still remaining in the list of active toasts. Attempt to sort active toasts in showToastsBottom() then triggered the crash. I don't know how to reproduce the crash, i.e. force destroying a toast in a way that its onClose() method (which would remove references to the toast) isn't called. So we'll just remove references to the toast whenever it's destroyed.
Diffstat (limited to 'indra/newview/llnearbychathandler.cpp')
-rw-r--r--indra/newview/llnearbychathandler.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 11dc496311..ae44c76038 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -268,6 +268,9 @@ bool LLNearbyChatScreenChannel::createPoolToast()
toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1));
+ // If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352).
+ toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, this, _1, false));
+
LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << llendl;
m_toast_pool.push_back(toast->getHandle());
return true;
@@ -371,6 +374,8 @@ void LLNearbyChatScreenChannel::arrangeToasts()
int sort_toasts_predicate(LLHandle<LLToast> first, LLHandle<LLToast> second)
{
+ if (!first.get() || !second.get()) return 0; // STORM-1352
+
F32 v1 = first.get()->getTimeLeftToLive();
F32 v2 = second.get()->getTimeLeftToLive();
return v1 > v2;