Commits

Richard Linden  committed 876647c

assert for updating views while drawing was too aggressive
made assert match actual error condition for list iterators

reviewed by Leslie

  • Participants
  • Parent commits a71790f

Comments (0)

Files changed (1)

File indra/llui/llview.cpp

 // virtual
 bool LLView::addChild(LLView* child, S32 tab_group)
 {
-	// NOTE: Changed this to not crash in release mode
-	llassert(mInDraw == false);
-
 	if (!child)
 	{
 		return false;
 // remove the specified child from the view, and set it's parent to NULL.
 void LLView::removeChild(LLView* child)
 {
-	llassert_always(mInDraw == false);
 	//llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
 	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 );
 		child->mParentView = NULL;
 		if (child->isCtrl())
 
 void LLView::drawChildren()
 {
-	mInDraw = true;
 	if (!mChildList.empty())
 	{
 		LLView* rootp = LLUI::getRootView();		
 					LLUI::pushMatrix();
 					{
 						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->mInDraw = false;
 
 						if (sDebugRects)
 						{
 		}
 		--sDepth;
 	}
-	mInDraw = false;
 }
 
 void LLView::dirtyRect()