Skip to content
Snippets Groups Projects
Commit 3169f4a9 authored by Richard Linden's avatar Richard Linden
Browse files

assert for updating views while drawing was too aggressive

made assert match actual error condition for list iterators

reviewed by Leslie
parent 9c8f6ba6
No related branches found
No related tags found
No related merge requests found
...@@ -282,9 +282,6 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) ...@@ -282,9 +282,6 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child)
// virtual // virtual
bool LLView::addChild(LLView* child, S32 tab_group) bool LLView::addChild(LLView* child, S32 tab_group)
{ {
// NOTE: Changed this to not crash in release mode
llassert(mInDraw == false);
if (!child) if (!child)
{ {
return false; return false;
...@@ -334,10 +331,11 @@ bool LLView::addChildInBack(LLView* child, S32 tab_group) ...@@ -334,10 +331,11 @@ bool LLView::addChildInBack(LLView* child, S32 tab_group)
// remove the specified child from the view, and set it's parent to NULL. // remove the specified child from the view, and set it's parent to NULL.
void LLView::removeChild(LLView* child) void LLView::removeChild(LLView* child)
{ {
llassert_always(mInDraw == false);
//llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs //llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
if (child->mParentView == this) if (child->mParentView == this)
{ {
// if we are removing an item we are currently iterating over, that would be bad
llassert(child->mInDraw == false);
mChildList.remove( child ); mChildList.remove( child );
child->mParentView = NULL; child->mParentView = NULL;
if (child->isCtrl()) if (child->isCtrl())
...@@ -1086,7 +1084,6 @@ void LLView::draw() ...@@ -1086,7 +1084,6 @@ void LLView::draw()
void LLView::drawChildren() void LLView::drawChildren()
{ {
mInDraw = true;
if (!mChildList.empty()) if (!mChildList.empty())
{ {
LLView* rootp = LLUI::getRootView(); LLView* rootp = LLUI::getRootView();
...@@ -1105,7 +1102,10 @@ void LLView::drawChildren() ...@@ -1105,7 +1102,10 @@ void LLView::drawChildren()
LLUI::pushMatrix(); LLUI::pushMatrix();
{ {
LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f); LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
// flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget
viewp->mInDraw = true;
viewp->draw(); viewp->draw();
viewp->mInDraw = false;
if (sDebugRects) if (sDebugRects)
{ {
...@@ -1125,7 +1125,6 @@ void LLView::drawChildren() ...@@ -1125,7 +1125,6 @@ void LLView::drawChildren()
} }
--sDepth; --sDepth;
} }
mInDraw = false;
} }
void LLView::dirtyRect() void LLView::dirtyRect()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment