diff options
| author | Merov Linden <merov@lindenlab.com> | 2012-06-29 11:59:14 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2012-06-29 11:59:14 -0700 | 
| commit | 71deb6d500238900bf7bf62cf957a68c063ade56 (patch) | |
| tree | 01ffc362dd9eaf40e2e238a6e7698f0083284b40 /indra | |
| parent | 7ce18c710fd573c94dd78eee2ac18cfef69c651e (diff) | |
CHUI-164 : Fix crash when removing ad-hoc conversation. Turns out that sessions uuids are not constant so I shouldn't use them as index in the conversation list. More complete fix to follow.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llimconversation.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 34 | ||||
| -rw-r--r-- | indra/newview/llimfloatercontainer.h | 2 | 
3 files changed, 22 insertions, 16 deletions
| diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index c734c3edd2..d7ef65edb6 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -359,7 +359,7 @@ void LLIMConversation::onClose(bool app_quitting)  		LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance();  		if (im_box)  		{ -            im_box->removeConversationListItem(mSessionID); +            im_box->removeConversationListItem(mSessionID,this);          }      }  } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 34a9758c52..85cc8cf38b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -416,19 +416,14 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI  		// Check if the item has changed  		if (item->hasSameValues(name,floaterp))  		{ -			// If it hasn't, nothing to do -> exit +			// If it hasn't changed, nothing to do -> exit  			return;  		} -		// If it has, remove it: it'll be recreated anew further down -		removeConversationListItem(uuid,false);  	} -	// Reverse find and clean up: we need to make sure that no other uuid is pointing to that same floater -	LLUUID found_id = LLUUID::null; -	if (findConversationItem(floaterp,found_id)) -	{ -		removeConversationListItem(found_id,false); -	} +	// Remove the conversation item that might exist already: it'll be recreated anew further down anyway +	// and nothing wrong will happen removing it if it doesn't exist +	removeConversationListItem(uuid,floaterp,false);  	// Create a conversation item  	LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); @@ -451,21 +446,32 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI  	return;  } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus)  { +	// Reverse find : we need to find the item that point to that floater +	// Note : the session UUID actually might change so we cannot really use it here +	// *TODO : Change the structure so that we use the floaterp and not the uuid as a map index +	LLUUID found_id = LLUUID::null; +	if (!findConversationItem(floaterp,found_id)) +	{ +		// If the floater wasn't found, we trust the passed id +		// Note: in most cases, the id doesn't correspond to any conversation either +		found_id = session_id; +	} +  	// Delete the widget and the associated conversation item  	// Note : since the mConversationsItems is also the listener to the widget, deleting   	// the widget will also delete its listener -	conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); +	conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(found_id);  	if (widget_it != mConversationsWidgets.end())  	{  		LLFolderViewItem* widget = widget_it->second;  		delete widget;  	} - +	  	// Suppress the conversation items and widgets from their respective maps -	mConversationsItems.erase(session_id); -	mConversationsWidgets.erase(session_id); +	mConversationsItems.erase(found_id); +	mConversationsWidgets.erase(found_id);  	// Reposition the leftover conversation items  	LLRect panel_rect = mConversationsListPanel->getRect(); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 2a8cbf3e1c..181aaa38a8 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -186,7 +186,7 @@ private:  	// CHUI-137 : Temporary implementation of conversations list  public: -	void removeConversationListItem(const LLUUID& session_id, bool change_focus = true); +	void removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus = true);  	void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp);  	bool findConversationItem(LLFloater* floaterp, LLUUID& uuid);  private: | 
