diff options
author | Roxie Linden <roxie@lindenlab.com> | 2010-02-26 01:52:28 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2010-02-26 01:52:28 -0800 |
commit | 2d7697dfade4ecbb8fbe9b26a5332fc9e93f5669 (patch) | |
tree | 5e956b1e9bfc1efd65bcd365abac613b4d4baf04 /indra/newview/llspeakingindicatormanager.cpp | |
parent | 5c73a908353cdd7210e3148f7162d30afab7873a (diff) | |
parent | 6ea944b38f1e619df2c52283f6b33bbcc1cbbc40 (diff) |
automated merge
Diffstat (limited to 'indra/newview/llspeakingindicatormanager.cpp')
-rw-r--r-- | indra/newview/llspeakingindicatormanager.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index 0aeef6ac40..aaceda4325 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -114,6 +114,13 @@ private: void switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on); /** + * Ensures that passed instance of Speaking Indicator does not exist among registered ones. + * If yes, it will be removed. + */ + void ensureInstanceDoesNotExist(LLSpeakingIndicator* const speaking_indicator); + + + /** * Multimap with all registered speaking indicators */ speaking_indicators_mmap_t mSpeakingIndicators; @@ -135,7 +142,11 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i { // do not exclude agent's indicators. They should be processed in the same way as others. See EXT-3889. - LL_DEBUGS("SpeakingIndicator") << "Registering indicator: " << speaker_id << LL_ENDL; + LL_DEBUGS("SpeakingIndicator") << "Registering indicator: " << speaker_id << "|"<< speaking_indicator << LL_ENDL; + + + ensureInstanceDoesNotExist(speaking_indicator); + speaking_indicator_value_t value_type(speaker_id, speaking_indicator); mSpeakingIndicators.insert(value_type); @@ -148,12 +159,14 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i void SpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator) { + LL_DEBUGS("SpeakingIndicator") << "Unregistering indicator: " << speaker_id << "|"<< speaking_indicator << LL_ENDL; speaking_indicators_mmap_t::iterator it; it = mSpeakingIndicators.find(speaker_id); for (;it != mSpeakingIndicators.end(); ++it) { if (it->second == speaking_indicator) { + LL_DEBUGS("SpeakingIndicator") << "Unregistered." << LL_ENDL; mSpeakingIndicators.erase(it); break; } @@ -231,6 +244,32 @@ void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& spea } } +void SpeakingIndicatorManager::ensureInstanceDoesNotExist(LLSpeakingIndicator* const speaking_indicator) +{ + LL_DEBUGS("SpeakingIndicator") << "Searching for an registered indicator instance: " << speaking_indicator << LL_ENDL; + speaking_indicators_mmap_t::iterator it = mSpeakingIndicators.begin(); + for (;it != mSpeakingIndicators.end(); ++it) + { + if (it->second == speaking_indicator) + { + LL_DEBUGS("SpeakingIndicator") << "Found" << LL_ENDL; + break; + } + } + + // It is possible with LLOutputMonitorCtrl the same instance of indicator is registered several + // times with different UUIDs. This leads to crash after instance is destroyed because the + // only one (specified by UUID in unregisterSpeakingIndicator()) is removed from the map. + // So, using stored deleted pointer leads to crash. See EXT-4782. + if (it != mSpeakingIndicators.end()) + { + llwarns << "The same instance of indicator has already been registered, removing it: " << it->first << "|"<< speaking_indicator << llendl; + llassert(it == mSpeakingIndicators.end()); + mSpeakingIndicators.erase(it); + } +} + + /************************************************************************/ /* LLSpeakingIndicatorManager namespace implementation */ /************************************************************************/ |