EXT-4754 Crash in LLEventTimer::updateClass

master
Tofu Linden 2010-02-04 11:24:14 +00:00
parent fd095d2785
commit 2c30ccf34d
4 changed files with 15 additions and 11 deletions

View File

@ -578,7 +578,7 @@ LLEventTimer::LLEventTimer(const LLDate& time)
LLEventTimer::~LLEventTimer()
{
llassert(!mBusy); // this LLEventTimer was destroyed from its own tick() function - bad.
llassert(!mBusy); // this LLEventTimer was destroyed from within its own tick() function - bad. if you want tick() to cause destruction of its own timer, make it return true.
}
//static

View File

@ -678,7 +678,8 @@ void LLCallFloater::resetVoiceRemoveTimers()
void LLCallFloater::removeVoiceRemoveTimer(const LLUUID& voice_speaker_id)
{
mSpeakerDelayRemover->unsetActionTimer(voice_speaker_id);
bool delete_it = true;
mSpeakerDelayRemover->unsetActionTimer(voice_speaker_id, delete_it);
}
bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id)

View File

@ -205,7 +205,7 @@ void LLSpeakersDelayActionsStorage::setActionTimer(const LLUUID& speaker_id)
}
}
void LLSpeakersDelayActionsStorage::unsetActionTimer(const LLUUID& speaker_id)
void LLSpeakersDelayActionsStorage::unsetActionTimer(const LLUUID& speaker_id, bool delete_it)
{
if (mActionTimersMap.size() == 0) return;
@ -213,7 +213,10 @@ void LLSpeakersDelayActionsStorage::unsetActionTimer(const LLUUID& speaker_id)
if (it_speaker != mActionTimersMap.end())
{
delete it_speaker->second;
if (delete_it)
{
delete it_speaker->second;
}
mActionTimersMap.erase(it_speaker);
}
}
@ -230,16 +233,15 @@ void LLSpeakersDelayActionsStorage::removeAllTimers()
bool LLSpeakersDelayActionsStorage::onTimerActionCallback(const LLUUID& speaker_id)
{
unsetActionTimer(speaker_id);
bool delete_it = false; // we're *in* this timer, return true to delete it, don't manually delete it
unsetActionTimer(speaker_id, delete_it);
if (mActionCallback)
{
mActionCallback(speaker_id);
}
// do not return true to avoid deleting of an timer twice:
// in LLSpeakersDelayActionsStorage::unsetActionTimer() & LLEventTimer::updateClass()
return false;
return true;
}
@ -291,7 +293,8 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
}
}
mSpeakerDelayRemover->unsetActionTimer(speakerp->mID);
bool delete_it = true;
mSpeakerDelayRemover->unsetActionTimer(speakerp->mID, delete_it);
return speakerp;
}

View File

@ -176,11 +176,11 @@ public:
void setActionTimer(const LLUUID& speaker_id);
/**
* Removes stored LLSpeakerActionTimer for passed speaker UUID from internal map and deletes it.
* Removes stored LLSpeakerActionTimer for passed speaker UUID from internal map and optionally deletes it.
*
* @see onTimerActionCallback()
*/
void unsetActionTimer(const LLUUID& speaker_id);
void unsetActionTimer(const LLUUID& speaker_id, bool delete_it);
void removeAllTimers();
private: