From e860925818fe9376fa9abb0520680dba986ab42e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 7 Dec 2011 15:03:45 -0800 Subject: Crash workaround when opening toats windows after a long session. --- indra/llui/llview.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llui/llview.cpp') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 486babb0ab..d2966fbe98 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1090,6 +1090,11 @@ void LLView::drawChildren() { child_list_reverse_iter_t child = child_iter++; LLView *viewp = *child; + + if (viewp == NULL) + { + continue; + } if (viewp->getVisible() && viewp->getRect().isValid()) { -- cgit v1.2.3 From 3861249a749c99c2a7b05d15ef82f8ff21453d05 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Jan 2012 09:41:16 -0800 Subject: use lazy deletion of views via die() method to avoid some potential crashes --- indra/llui/llview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llui/llview.cpp') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 486babb0ab..1529381773 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -121,6 +121,7 @@ LLView::Params::Params() LLView::LLView(const LLView::Params& p) : mVisible(p.visible), + mInDraw(false), mName(p.name), mParentView(NULL), mReshapeFlags(FOLLOWS_NONE), @@ -281,6 +282,8 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) // virtual bool LLView::addChild(LLView* child, S32 tab_group) { + llassert_always(mInDraw == false); + if (!child) { return false; @@ -330,6 +333,7 @@ bool LLView::addChildInBack(LLView* child, S32 tab_group) // 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) { @@ -1081,6 +1085,7 @@ void LLView::draw() void LLView::drawChildren() { + mInDraw = true; if (!mChildList.empty()) { LLView* rootp = LLUI::getRootView(); @@ -1119,6 +1124,7 @@ void LLView::drawChildren() } --sDepth; } + mInDraw = false; } void LLView::dirtyRect() -- cgit v1.2.3 From 9c8f6ba6a51b799d16e89e995bbcf3b0dcc15c62 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 4 Jan 2012 17:37:57 -0800 Subject: Modified CRASH assert to not occur in release mode per Richard --- indra/llui/llview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui/llview.cpp') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 1529381773..542f57ee5f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -282,7 +282,8 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) // virtual bool LLView::addChild(LLView* child, S32 tab_group) { - llassert_always(mInDraw == false); + // NOTE: Changed this to not crash in release mode + llassert(mInDraw == false); if (!child) { -- cgit v1.2.3 From 3169f4a96fd4c62d1390cd53ff2aaa4cb28fb047 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 11 Jan 2012 10:19:11 -0800 Subject: assert for updating views while drawing was too aggressive made assert match actual error condition for list iterators reviewed by Leslie --- indra/llui/llview.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/llui/llview.cpp') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 542f57ee5f..004681325f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -282,9 +282,6 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) // 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; @@ -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. 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()) @@ -1086,7 +1084,6 @@ void LLView::draw() void LLView::drawChildren() { - mInDraw = true; if (!mChildList.empty()) { LLView* rootp = LLUI::getRootView(); @@ -1105,7 +1102,10 @@ void LLView::drawChildren() 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) { @@ -1125,7 +1125,6 @@ void LLView::drawChildren() } --sDepth; } - mInDraw = false; } void LLView::dirtyRect() -- cgit v1.2.3