From 7f2ea292e10b10958b3e00a641b50b194f131e41 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Wed, 31 Oct 2012 19:27:41 -0700
Subject: [PATCH] CHUI-474 : Fixed. Refresh the participants list in torn off
 dialog more often.

---
 indra/llui/llfolderview.cpp        |  2 +-
 indra/newview/llimconversation.cpp | 40 +++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index c31a8321416..a33ffc4240c 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -566,7 +566,7 @@ void LLFolderView::sanitizeSelection()
 				parent_folder;
 				parent_folder = parent_folder->getParentFolder())
 			{
-				if (parent_folder->getViewModelItem()->potentiallyVisible())
+				if (parent_folder->getViewModelItem() && parent_folder->getViewModelItem()->potentiallyVisible())
 				{
 					// give initial selection to first ancestor folder that potentially passes the filter
 					if (!new_selection)
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index 3b6294f43b2..aee66421507 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -376,7 +376,44 @@ void LLIMConversation::updateConversationViewParticipant(const LLUUID& participa
 
 void LLIMConversation::refreshConversation()
 {
-	// *TODO: check that all participant models do have a view (debug consistency check)
+	// Debug : Check that all participant models do have a view (debug consistency check)
+	/*
+	LLParticipantList* item = getParticipantList();
+	llinfos << "Merov debug : Start consistency check" << llendl;
+	LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
+	LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
+	while (current_participant_model != end_participant_model)
+	{
+		LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
+		if (participant_model != NULL)
+		{
+			LLUUID uuid = participant_model->getUUID();
+			LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid);
+			if (!widget)
+			{
+				llinfos << "Merov debug : Consistency error! Couldn't find widget for " << participant_model->getName() << llendl;
+			}
+			else 
+			{
+				llinfos << "Merov debug : Consistency check pass for " << participant_model->getName() << llendl;
+			}
+		}
+		else
+		{
+			llinfos << "Merov debug : Consistency check, skip non participant child" << llendl;
+		}
+		current_participant_model++;
+	}
+	llinfos << "Merov debug : End consistency check" << llendl;
+	 */
+		
+	conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
+	while (widget_it != mConversationsWidgets.end())
+	{
+		widget_it->second->refresh();
+		widget_it->second->setVisible(TRUE);
+		++widget_it;
+	}
 	mConversationViewModel.requestSortAll();
 	mConversationsRoot->arrangeAll();
 	mConversationsRoot->update();
@@ -629,6 +666,7 @@ void LLIMConversation::onTearOffClicked()
     initRectControl();
 	LLFloater::onClickTearOff(this);
 	updateHeaderAndToolbar();
+	refreshConversation();
 }
 
 // static
-- 
GitLab