Bug fix: don't loop endlessly when getParentFloater returns it's argument.
It has happened to me that this hung the viewer. The cause is that
when you call parent->getParentFloater(child), then getParentFloater
which starts like this:
LLFloater* LLFloaterView::getParentFloater(LLView* viewp)
{
LLView* parentp = viewp->getParent();
starts with parentp == this. And the following logic causes
it to return 'viewp'!
I'm pretty sure that getParentFloater's whole design is wrong,
but I don't see another way to avoid this problem then with
this hack, except by making changes that do a lot more and
are a risk with regard breaking code elsewhere.
This commit is contained in:
@@ -1356,14 +1356,20 @@ LLFloater* LLFloater::getClosableFloaterFromFocus()
|
||||
|
||||
// The focused floater may not be closable,
|
||||
// Find and close a parental floater that is closeable, if any.
|
||||
LLFloater* previous_floater = NULL; // Guard against endless loop, because getParentFloater(x) can return x!
|
||||
for(LLFloater* floater_to_close = focused_floater;
|
||||
NULL != floater_to_close;
|
||||
floater_to_close = gFloaterView->getParentFloater(floater_to_close))
|
||||
{
|
||||
if(floater_to_close == previous_floater)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(floater_to_close->isCloseable())
|
||||
{
|
||||
return floater_to_close;
|
||||
}
|
||||
previous_floater = floater_to_close;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user