EXT-6693 - [crashhunters] crash in LLPopupView::handleMouseEvent

Richard Linden 2010-04-07 16:29:06 -07:00
parent c5756c3f0f
commit 69e6c4d947
1 changed files with 11 additions and 10 deletions

View File

@ -104,8 +104,13 @@ BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func
S32 x, S32 y,
bool close_popups)
{
for (popup_list_t::iterator popup_it = mPopups.begin();
popup_it != mPopups.end();)
BOOL handled = FALSE;
// make a copy of list of popups, in case list is modified during mouse event handling
popup_list_t popups(mPopups);
for (popup_list_t::iterator popup_it = popups.begin(), popup_end = popups.end();
popup_it != popup_end;
++popup_it)
{
LLView* popup = popup_it->get();
if (!popup
@ -121,23 +126,19 @@ BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func
{
if (func(popup, popup_x, popup_y))
{
return TRUE;
handled = TRUE;
break;
}
}
if (close_popups)
{
popup_list_t::iterator cur_popup_it = popup_it++;
mPopups.erase(cur_popup_it);
mPopups.remove(*popup_it);
popup->onTopLost();
}
else
{
++popup_it;
}
}
return FALSE;
return handled;
}