summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-03-05 18:11:55 -0800
committerMonroe Linden <monroe@lindenlab.com>2010-03-05 18:11:55 -0800
commiteee50d1401ff7dfcb9c9fdc2c6e61e6d6281f5e2 (patch)
treed3e0adbe278ff4409cc492006c89eb71fa97ff38
parent9412447b4f49e068fc5890821ed4b8686e13d723 (diff)
Fix for a crash on startup/shutdown introduced in the tip of viewer-2-0 very recently.
list.erase(list.find()) is not safe, because erasing list.end() is undefined. Check to make sure the find succeeded before doing the erase. Reviewed by Richard at http://codereview.lindenlab.com/341001
-rw-r--r--indra/newview/llpopupview.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index 590a45c96c..1668a91eed 100644
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -207,7 +207,11 @@ void LLPopupView::addPopup(LLView* popup)
{
if (popup)
{
- mPopups.erase(std::find(mPopups.begin(), mPopups.end(), popup->getHandle()));
+ popup_list_t::iterator iter = std::find(mPopups.begin(), mPopups.end(), popup->getHandle());
+ if(iter != mPopups.end())
+ {
+ mPopups.erase(iter);
+ }
mPopups.push_front(popup->getHandle());
}
}
@@ -220,7 +224,11 @@ void LLPopupView::removePopup(LLView* popup)
{
gFocusMgr.setKeyboardFocus(NULL);
}
- mPopups.erase(std::find(mPopups.begin(), mPopups.end(), popup->getHandle()));
+ popup_list_t::iterator iter = std::find(mPopups.begin(), mPopups.end(), popup->getHandle());
+ if(iter != mPopups.end())
+ {
+ mPopups.erase(iter);
+ }
popup->onTopLost();
}
}