summaryrefslogtreecommitdiff
path: root/indra/newview/llscreenchannel.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-11-26 15:01:57 -0800
committerMerov Linden <merov@lindenlab.com>2012-11-26 15:01:57 -0800
commit8076f7a33d7f5ee93d4ba8f71a7ba0fed5e364a7 (patch)
tree6a7d0f88666e16948e73d1098c99edc7513b6e49 /indra/newview/llscreenchannel.cpp
parent7ca2508cc2adcdc5201bd53e814246e156bc6013 (diff)
parent890965faf5baa5f6f832e086991d59bb8d33b7bc (diff)
Pull merge from richard/viewer-chui
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r--indra/newview/llscreenchannel.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 3bcf36ffde..154555b261 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -588,9 +588,13 @@ void LLScreenChannel::showToastsBottom()
LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
- for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
+ // Use a local variable instead of mToastList.
+ // mToastList can be modified during recursive calls and then all iteratos will be invalidated.
+ std::vector<ToastElem> vToastList( mToastList );
+
+ for(it = vToastList.rbegin(); it != vToastList.rend(); ++it)
{
- if(it != mToastList.rbegin())
+ if(it != vToastList.rbegin())
{
LLToast* toast = (it-1)->getToast();
if (!toast)
@@ -618,7 +622,7 @@ void LLScreenChannel::showToastsBottom()
if(floater && floater->overlapsScreenChannel())
{
- if(it == mToastList.rbegin())
+ if(it == vToastList.rbegin())
{
// move first toast above docked floater
S32 shift = floater->getRect().getHeight();
@@ -641,7 +645,7 @@ void LLScreenChannel::showToastsBottom()
if(!stop_showing_toasts)
{
- if( it != mToastList.rend()-1)
+ if( it != vToastList.rend()-1)
{
S32 toast_top = toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
stop_showing_toasts = toast_top > getRect().mTop;
@@ -649,7 +653,8 @@ void LLScreenChannel::showToastsBottom()
}
// at least one toast should be visible
- if(it == mToastList.rbegin())
+
+ if(it == vToastList.rbegin())
{
stop_showing_toasts = false;
}
@@ -672,10 +677,11 @@ void LLScreenChannel::showToastsBottom()
}
// Dismiss toasts we don't have space for (STORM-391).
- if(it != mToastList.rend())
+ if(it != vToastList.rend())
{
mHiddenToastsNum = 0;
- for(; it != mToastList.rend(); it++)
+
+ for(; it != vToastList.rend(); it++)
{
LLToast* toast = it->getToast();
if (toast)
@@ -731,9 +737,13 @@ void LLScreenChannel::showToastsTop()
LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
- for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
+ // Use a local variable instead of mToastList.
+ // mToastList can be modified during recursive calls and then all iteratos will be invalidated.
+ std::vector<ToastElem> vToastList( mToastList );
+
+ for(it = vToastList.rbegin(); it != vToastList.rend(); ++it)
{
- if(it != mToastList.rbegin())
+ if(it != vToastList.rbegin())
{
LLToast* toast = (it-1)->getToast();
if (!toast)
@@ -761,7 +771,7 @@ void LLScreenChannel::showToastsTop()
if(floater && floater->overlapsScreenChannel())
{
- if(it == mToastList.rbegin())
+ if(it == vToastList.rbegin())
{
// move first toast above docked floater
S32 shift = -floater->getRect().getHeight();
@@ -784,7 +794,7 @@ void LLScreenChannel::showToastsTop()
if(!stop_showing_toasts)
{
- if( it != mToastList.rend()-1)
+ if( it != vToastList.rend()-1)
{
S32 toast_bottom = toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
stop_showing_toasts = toast_bottom < channel_rect.mBottom;
@@ -792,7 +802,7 @@ void LLScreenChannel::showToastsTop()
}
// at least one toast should be visible
- if(it == mToastList.rbegin())
+ if(it == vToastList.rbegin())
{
stop_showing_toasts = false;
}
@@ -816,10 +826,12 @@ void LLScreenChannel::showToastsTop()
// Dismiss toasts we don't have space for (STORM-391).
std::vector<LLToast*> toasts_to_hide;
- if(it != mToastList.rend())
+
+ if(it != vToastList.rend())
{
mHiddenToastsNum = 0;
- for(; it != mToastList.rend(); it++)
+
+ for(; it != vToastList.rend(); it++)
{
LLToast* toast = it->getToast();
if (toast)