summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llui/llfolderviewitem.cpp26
-rw-r--r--indra/llui/llfolderviewmodel.h2
-rw-r--r--indra/newview/llconversationmodel.cpp2
3 files changed, 22 insertions, 8 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 5d4c27ee6c..b289581dc2 100755
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -1563,7 +1563,7 @@ BOOL LLFolderViewFolder::isRemovable()
void LLFolderViewFolder::addItem(LLFolderViewItem* item)
{
if (item->getParentFolder())
-{
+ {
item->getParentFolder()->extractItem(item);
}
item->setParentFolder(this);
@@ -1574,7 +1574,13 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item)
item->setVisible(FALSE);
addChild(item);
- getViewModelItem()->addChild(item->getViewModelItem());
+
+ // When the model is already hooked into a hierarchy (i.e. has a parent), do not reparent it
+ // Note: this happens when models are created before views or shared between views
+ if (!item->getViewModelItem()->hasParent())
+ {
+ getViewModelItem()->addChild(item->getViewModelItem());
+ }
//TODO RN - make sort bubble up as long as parent Folder doesn't have anything matching sort criteria
//// Traverse parent folders and update creation date and resort, if necessary
@@ -1593,11 +1599,11 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item)
// this is an internal method used for adding items to folders.
void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
- {
+{
if (folder->mParentFolder)
- {
+ {
folder->mParentFolder->extractItem(folder);
- }
+ }
folder->mParentFolder = this;
mFolders.push_back(folder);
folder->setOrigin(0, 0);
@@ -1607,9 +1613,15 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
//folder->requestArrange();
//requestSort();
- addChild( folder );
- getViewModelItem()->addChild(folder->getViewModelItem());
+ addChild(folder);
+
+ // When the model is already hooked into a hierarchy (i.e. has a parent), do not reparent it
+ // Note: this happens when models are created before views or shared between views
+ if (!folder->getViewModelItem()->hasParent())
+ {
+ getViewModelItem()->addChild(folder->getViewModelItem());
}
+}
void LLFolderViewFolder::requestArrange()
{
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 5ec08ae211..7019857c0f 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -202,6 +202,7 @@ public:
virtual S32 getSortVersion() = 0;
virtual void setSortVersion(S32 version) = 0;
virtual void setParent(LLFolderViewModelItem* parent) = 0;
+ virtual bool hasParent() = 0;
protected:
@@ -332,6 +333,7 @@ public:
protected:
virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; }
+ virtual bool hasParent() { return mParent != NULL; }
S32 mSortVersion;
bool mPassedFilter;
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index f0c8658cfe..74188195f6 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -405,8 +405,8 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam
{
parent_session->requestSort();
parent_session->updateParticipantName(this);
+ postEvent("update_participant", parent_session, this);
}
- postEvent("update_participant", parent_session, this);
}
void LLConversationItemParticipant::dumpDebugData()