From 9275379e3ce20f6a27341e595481ce57c3a6b954 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 12 Dec 2012 18:59:24 +0200 Subject: CHUI-584 : WIP : Viewer crash when clicking on view/sort options drop down in conversation floater: Renaming of local vfriables in accordance with the code convention --- indra/newview/llfloaterimcontainer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 75b311eecf..5d41f46b3f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -891,37 +891,37 @@ void LLFloaterIMContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids) const LLConversationItem * LLFloaterIMContainer::getCurSelectedViewModelItem() { - LLConversationItem * conversationItem = NULL; + LLConversationItem * conversation_item = NULL; if(mConversationsRoot && mConversationsRoot->getCurSelectedItem() && mConversationsRoot->getCurSelectedItem()->getViewModelItem()) { - LLFloaterIMSessionTab *selectedSession = LLFloaterIMSessionTab::getConversation(mSelectedSession); - if (selectedSession && selectedSession->isTornOff()) + LLFloaterIMSessionTab *selected_session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession); + if (selected_session_floater && !selected_session_floater->getHost()) { - conversationItem = selectedSession->getCurSelectedViewModelItem(); + conversation_item = selected_session_floater->getCurSelectedViewModelItem(); } else { - conversationItem = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); + conversation_item = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); } } - return conversationItem; + return conversation_item; } void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) { //Find the conversation floater associated with the selected id - const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + const LLConversationItem * conversation_item = getCurSelectedViewModelItem(); if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) { getSelectedUUIDs(selected_uuids); } //When a one-on-one conversation exists, retrieve the participant id from the conversation floater - else if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + else if(conversation_item->getType() == LLConversationItem::CONV_SESSION_1_ON_1) { LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(conversationItem->getUUID()); LLUUID participantID = conversationFloater->getOtherParticipantUUID(); -- cgit v1.2.3 From 322fb006306524481ee09e88a079457b86fcd95a Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 12 Dec 2012 19:05:40 +0200 Subject: CHUI-584 : Fixed : Viewer crash when clicking on view/sort options drop down in conversation floater: Protection from a lack of the current selection. It need for the newly created floater, which still is not finished adding the first conversation item. --- indra/newview/llfloaterimcontainer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 5d41f46b3f..82bcd8efa4 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -916,7 +916,12 @@ void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) //Find the conversation floater associated with the selected id const LLConversationItem * conversation_item = getCurSelectedViewModelItem(); - if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) + if (NULL == conversation_item) + { + return; + } + + if (conversation_item->getType() == LLConversationItem::CONV_PARTICIPANT) { getSelectedUUIDs(selected_uuids); } -- cgit v1.2.3 From 4c20cc3e46d0392c63ecec304858493c8f59059b Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 12 Dec 2012 18:53:06 +0200 Subject: CHUI-584 : Addit. fix : Viewer crash when clicking on view/sort options drop down in conversation floater: Cancelled unconditional receiving a instance of the floater (LLFloaterReg::getInstance()) from LLFloaterIMContainer::selectConversationPair(), because in some situations this method is called from LLFloaterIMNearbyChat::postBuild() - In other words, while the unfinished process of creation of this floater --- indra/newview/llfloaterimcontainer.cpp | 57 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 82bcd8efa4..3a5f2ae854 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -928,9 +928,9 @@ void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) //When a one-on-one conversation exists, retrieve the participant id from the conversation floater else if(conversation_item->getType() == LLConversationItem::CONV_SESSION_1_ON_1) { - LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(conversationItem->getUUID()); - LLUUID participantID = conversationFloater->getOtherParticipantUUID(); - selected_uuids.push_back(participantID); + LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(conversation_item->getUUID()); + LLUUID participant_id = conversation_floaterp->getOtherParticipantUUID(); + selected_uuids.push_back(participant_id); } } @@ -1239,13 +1239,13 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id) void LLFloaterIMContainer::selectConversation(const LLUUID& session_id) { selectConversationPair(session_id, true); - } +} // Synchronous select the conversation item and the conversation floater BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget) { BOOL handled = TRUE; - LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id); /* widget processing */ if (select_widget) @@ -1259,26 +1259,29 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool /* floater processing */ - if (session_id != getSelectedSession()) - { - // Store the active session - setSelectedSession(session_id); + if (NULL != session_floater) + { + if (session_id != getSelectedSession()) + { + // Store the active session + setSelectedSession(session_id); - if (session_floater->getHost()) - { - // Always expand the message pane if the panel is hosted by the container - collapseMessagesPane(false); - // Switch to the conversation floater that is being selected - selectFloater(session_floater); + if (session_floater->getHost()) + { + // Always expand the message pane if the panel is hosted by the container + collapseMessagesPane(false); + // Switch to the conversation floater that is being selected + selectFloater(session_floater); + } } - } - // Set the focus on the selected floater - if (!session_floater->hasFocus()) - { - session_floater->setFocus(TRUE); + // Set the focus on the selected floater + if (!session_floater->hasFocus()) + { + session_floater->setFocus(TRUE); + } } return handled; @@ -1388,12 +1391,14 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& // set the widget to minimized mode if conversations pane is collapsed widget->toggleCollapsedMode(mConversationsPane->isCollapsed()); - if (isWidgetSelected) - { - selectConversation(uuid); - // scroll to newly added item - mConversationsRoot->scrollToShowSelection(); - } + if (isWidgetSelected || 0 == mConversationsRoot->getSelectedCount()) + { + selectConversationPair(uuid, true); + widget->requestArrange(); + + // scroll to newly added item + mConversationsRoot->scrollToShowSelection(); + } return item; } -- cgit v1.2.3