summaryrefslogtreecommitdiff
path: root/indra/llui/llfolderviewmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llfolderviewmodel.h')
-rw-r--r--indra/llui/llfolderviewmodel.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 22bfc4dfb4..c6030c9b71 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -226,7 +226,7 @@ public:
mParent(NULL),
mRootViewModel(root_view_model)
{
- std::for_each(mChildren.begin(), mChildren.end(), DeletePointer());
+ mChildren.clear();
}
void requestSort() { mSortVersion = -1; }
@@ -254,6 +254,16 @@ public:
virtual void addChild(LLFolderViewModelItem* child)
{
+ // Avoid duplicates: bail out if that child is already present in the list
+ // Note: this happens when models are created before views
+ child_list_t::const_iterator iter;
+ for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
+ {
+ if (child == *iter)
+ {
+ return;
+ }
+ }
mChildren.push_back(child);
child->setParent(this);
dirtyFilter();