viewer-private#262 webrtc crashes on shutdown

removeObserver failed to remove an im session floater
master
Andrey Kleshchev 2024-08-13 08:55:23 +03:00 committed by Andrey Kleshchev
parent 2e2f10f7dd
commit e086437f12
11 changed files with 63 additions and 61 deletions

View File

@ -98,10 +98,7 @@ LLConversationViewSession::~LLConversationViewSession()
if (mVoiceClientObserver)
{
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver);
}
LLVoiceClient::removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
@ -259,16 +256,15 @@ BOOL LLConversationViewSession::postBuild()
icon->setVisible(true);
mSpeakingIndicator->setSpeakerId(gAgentID, LLUUID::null, true);
mIsInActiveVoiceChannel = true;
if(LLVoiceClient::instanceExists())
if (mVoiceClientObserver)
{
if (mVoiceClientObserver)
{
LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this);
LLVoiceClient::getInstance()->addObserver(mVoiceClientObserver);
LLVoiceClient::removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this);
LLVoiceClient::addObserver(mVoiceClientObserver);
break;
}
default:

View File

@ -287,10 +287,8 @@ void LLFloaterIMSession::sendMsg(const std::string& msg)
LLFloaterIMSession::~LLFloaterIMSession()
{
mVoiceChannelStateChangeConnection.disconnect();
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
@ -366,7 +364,7 @@ BOOL LLFloaterIMSession::postBuild()
childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
//see LLFloaterIMPanel for how it is done (IB)
@ -537,6 +535,7 @@ void LLFloaterIMSession::boundVoiceChannel()
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
if(voice_channel)
{
mVoiceChannelStateChangeConnection.disconnect();
mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(
boost::bind(&LLFloaterIMSession::onVoiceChannelStateChanged, this, _1, _2));

View File

@ -433,7 +433,7 @@ void LLFloaterIMSessionTab::draw()
void LLFloaterIMSessionTab::enableDisableCallBtn()
{
if (!LLApp::isExiting() && LLVoiceClient::instanceExists() && mVoiceButton)
if (LLVoiceClient::instanceExists() && mVoiceButton)
{
mVoiceButton->setEnabled(
mSessionID.notNull()
@ -546,6 +546,12 @@ void LLFloaterIMSessionTab::closeFloater(bool app_quitting)
super::closeFloater(app_quitting);
}
void LLFloaterIMSessionTab::deleteAllChildren()
{
super::deleteAllChildren();
mVoiceButton = NULL;
}
std::string LLFloaterIMSessionTab::appendTime()
{
std::string timeStr = "[" + LLTrans::getString("TimeHour") + "]:"

View File

@ -82,6 +82,7 @@ public:
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ void setFocus(BOOL focus);
/*virtual*/ void closeFloater(bool app_quitting = false);
/*virtual*/ void deleteAllChildren();
// Handle the left hand participant list widgets
void addConversationViewParticipant(LLConversationItem* item, bool update_view = true);

View File

@ -98,10 +98,7 @@ LLPanelGroup::LLPanelGroup()
LLPanelGroup::~LLPanelGroup()
{
LLGroupMgr::getInstance()->removeObserver(this);
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
void LLPanelGroup::onOpen(const LLSD& key)
@ -194,7 +191,7 @@ BOOL LLPanelGroup::postBuild()
mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
}
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
return TRUE;
}

View File

@ -338,7 +338,7 @@ public:
LLAvatarTracker::instance().addObserver(this);
// For notification when SIP online status changes.
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
mInvObserver = new LLInventoryFriendCardObserver(this);
}
@ -346,10 +346,7 @@ public:
{
// will be deleted by ~LLInventoryModel
//delete mInvObserver;
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
LLAvatarTracker::instance().removeObserver(this);
}
@ -577,10 +574,7 @@ LLPanelPeople::~LLPanelPeople()
delete mFriendListUpdater;
delete mRecentListUpdater;
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list)
@ -721,7 +715,7 @@ BOOL LLPanelPeople::postBuild()
// Must go after setting commit callback and initializing all pointers to children.
mTabContainer->selectTabByName(NEARBY_TAB_NAME);
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
// call this method in case some list is empty and buttons can be in inconsistent state
updateButtons();

View File

@ -702,10 +702,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife()
LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
}
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
LLVoiceClient::removeObserver((LLVoiceClientStatusObserver*)this);
if (mAvatarNameCacheConnection.connected())
{

View File

@ -182,7 +182,7 @@ void SpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker
SpeakingIndicatorManager::SpeakingIndicatorManager()
{
LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&SpeakingIndicatorManager::sOnCurrentChannelChanged, this, _1));
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
}
SpeakingIndicatorManager::~SpeakingIndicatorManager()
@ -193,10 +193,7 @@ void SpeakingIndicatorManager::cleanupSingleton()
{
// Don't use LLVoiceClient::getInstance() here without a check,
// singleton MAY have already been destroyed.
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)

View File

@ -81,10 +81,7 @@ LLVoiceChannel::~LLVoiceChannel()
{
sCurrentVoiceChannel = NULL;
// Must check instance exists here, the singleton MAY have already been destroyed.
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
sVoiceChannelMap.erase(mSessionID);
@ -219,7 +216,7 @@ void LLVoiceChannel::deactivate()
LLVoiceClient::getInstance()->setUserPTTState(false);
}
}
LLVoiceClient::getInstance()->removeObserver(this);
LLVoiceClient::removeObserver(this);
if (sCurrentVoiceChannel == this)
{
@ -259,7 +256,7 @@ void LLVoiceChannel::activate()
setState(STATE_CALL_STARTED);
}
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
sCurrentVoiceChannelChangedSignal(this->mSessionID);
@ -751,7 +748,7 @@ void LLVoiceChannelProximal::deactivate()
{
setState(STATE_HUNG_UP);
}
LLVoiceClient::getInstance()->removeObserver(this);
LLVoiceClient::removeObserver(this);
LLVoiceClient::getInstance()->activateSpatialChannel(false);
}

View File

@ -796,8 +796,14 @@ void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
}
void LLVoiceClient::addObserver(LLFriendObserver* observer)
@ -808,8 +814,14 @@ void LLVoiceClient::addObserver(LLFriendObserver* observer)
void LLVoiceClient::removeObserver(LLFriendObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
}
void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
@ -820,8 +832,14 @@ void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
}
std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const

View File

@ -482,12 +482,12 @@ public:
void onRegionChanged();
void addObserver(LLVoiceClientStatusObserver* observer);
void removeObserver(LLVoiceClientStatusObserver* observer);
void addObserver(LLFriendObserver* observer);
void removeObserver(LLFriendObserver* observer);
void addObserver(LLVoiceClientParticipantObserver* observer);
void removeObserver(LLVoiceClientParticipantObserver* observer);
static void addObserver(LLVoiceClientStatusObserver* observer);
static void removeObserver(LLVoiceClientStatusObserver* observer);
static void addObserver(LLFriendObserver* observer);
static void removeObserver(LLFriendObserver* observer);
static void addObserver(LLVoiceClientParticipantObserver* observer);
static void removeObserver(LLVoiceClientParticipantObserver* observer);
std::string sipURIFromID(const LLUUID &id) const;
LLSD getP2PChannelInfoTemplate(const LLUUID& id) const;