diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2012-07-03 22:32:21 +0300 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2012-07-03 22:32:21 +0300 |
commit | ac0243a006fa28e872e4ee88f7c1588eaefeaecf (patch) | |
tree | 6f32d9470da1c857e31fcf83ea99e357a70e674f /indra | |
parent | ad1f2eb5106a9ba0217ff1080d029f912ecc25e5 (diff) |
CHUI-188 FIX for crash in adding chat participants.
Modified the duplicated participants check procedure LLIMFloater::canAddSelectedToChat() to use the list, updated by LLSpeakerMgr instead of LLIMSession::mInitialTargetIDs list, which is initialized at session start and not updated afterwards.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llimfloater.cpp | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 536d0b9a23..a506f0f9f3 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -339,34 +339,54 @@ void LLIMFloater::onAddButtonClicked() bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) { - if (!mSession - || mDialog == IM_SESSION_GROUP_START - || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) - { - return false; - } + if (!mSession + || mDialog == IM_SESSION_GROUP_START + || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) + { + return false; + } - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) - { - // Skip this check for ad hoc conferences, - // conference participants should be listed in mSession->mInitialTargetIDs. - if (mIsP2PChat && *id == mOtherParticipantUUID) - { - return false; - } - - for (uuid_vec_t::const_iterator target_id = mSession->mInitialTargetIDs.begin(); - target_id != mSession->mInitialTargetIDs.end(); ++target_id) - { - if (*id == *target_id) - { - return false; - } - } - } + if (mIsP2PChat) + { + // For a P2P session just check if we are not adding the other participant. + + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + if (*id == mOtherParticipantUUID) + { + return false; + } + } + } + else + { + // For a conference session we need to check against the list from LLSpeakerMgr, + // because this list may change when participants join or leave the session. + + LLSpeakerMgr::speaker_list_t speaker_list; + LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + if (speaker_mgr) + { + speaker_mgr->getSpeakerList(&speaker_list, true); + } - return true; + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin(); + it != speaker_list.end(); ++it) + { + const LLPointer<LLSpeaker>& speaker = *it; + if (*id == speaker->mID) + { + return false; + } + } + } + } + + return true; } void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) |