summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-07-11 03:05:07 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-07-11 03:10:36 +0300
commite80f0f331dbfca686e0a80c557e9b1e455c8d167 (patch)
treed677d3378e0c5f911682182872f31a76531afd8b /indra/newview
parentd61e6fc7eca41bba6def1d5904ec829dd71f011f (diff)
SL-19986 Crash at LLConversationItemSession::findParticipant
Observed on bugsplat, no repro. Something destroys LLConversationItem without cleaning list (some sessions reuse the item, but they aren't supposed to remove it). Either item should inform floater to be properly removed or should be stored as an LLPointer.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llconversationmodel.h2
-rw-r--r--indra/newview/llfloaterimcontainer.cpp22
-rw-r--r--indra/newview/llfloaterimcontainer.h2
3 files changed, 20 insertions, 6 deletions
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 7c6980a7e6..457b2e83fb 100644
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -40,7 +40,7 @@ class LLConversationItem;
class LLConversationItemSession;
class LLConversationItemParticipant;
-typedef std::map<LLUUID, LLConversationItem*> conversations_items_map;
+typedef std::map<LLUUID, LLPointer<LLConversationItem> > conversations_items_map;
typedef std::map<LLUUID, LLFolderViewItem*> conversations_widgets_map;
typedef std::vector<std::string> menuentry_vec_t;
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 2720b7fcf7..172e672dc5 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -155,6 +155,20 @@ void LLFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const
LLFloaterIMSessionTab::addToHost(new_session_id);
}
+
+LLConversationItem* LLFloaterIMContainer::getSessionModel(const LLUUID& session_id)
+{
+ conversations_items_map::iterator iter = mConversationsItems.find(session_id);
+ if (iter == mConversationsItems.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return iter->second.get();
+ }
+}
+
void LLFloaterIMContainer::sessionRemoved(const LLUUID& session_id)
{
removeConversationListItem(session_id);
@@ -608,7 +622,8 @@ void LLFloaterIMContainer::handleConversationModelEvent(const LLSD& event)
}
else if (type == "add_participant")
{
- LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(mConversationsItems[session_id]);
+ LLConversationItem* item = getSessionModel(session_id);
+ LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(item);
LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL);
LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(session_id);
if (!participant_view && session_model && participant_model)
@@ -1749,10 +1764,9 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
void LLFloaterIMContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id)
{
- LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(get_ptr_in_map(mConversationsItems,session_id));
+ LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(getSessionModel(session_id));
if (item)
{
- item->setTimeNow(participant_id);
mConversationViewModel.requestSortAll();
mConversationsRoot->arrangeAll();
}
@@ -1761,7 +1775,7 @@ void LLFloaterIMContainer::setTimeNow(const LLUUID& session_id, const LLUUID& pa
void LLFloaterIMContainer::setNearbyDistances()
{
// Get the nearby chat session: that's the one with uuid nul
- LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(get_ptr_in_map(mConversationsItems,LLUUID()));
+ LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(getSessionModel(LLUUID()));
if (item)
{
// Get the positions of the nearby avatars and their ids
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index b4a9d377ab..82f3b00ebc 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -106,7 +106,7 @@ public:
LLConversationViewModel& getRootViewModel() { return mConversationViewModel; }
LLUUID getSelectedSession() { return mSelectedSession; }
void setSelectedSession(LLUUID sessionID) { mSelectedSession = sessionID; }
- LLConversationItem* getSessionModel(const LLUUID& session_id) { return get_ptr_in_map(mConversationsItems,session_id); }
+ LLConversationItem* getSessionModel(const LLUUID& session_id);
LLConversationSort& getSortOrder() { return mConversationViewModel.getSorter(); }
// Handling of lists of participants is public so to be common with llfloatersessiontab