diff options
author | Mark Palange (Mani) <palange@lindenlab.com> | 2010-02-05 18:15:31 -0800 |
---|---|---|
committer | Mark Palange (Mani) <palange@lindenlab.com> | 2010-02-05 18:15:31 -0800 |
commit | ec076c97feaa2976520e28fd1c1b23099be656d7 (patch) | |
tree | 155192061e0150364f80213b2ba7ea040c8183ac /indra/llcommon | |
parent | 02511c41713da468a5e2620a8bc1bb0fcdfd64da (diff) |
EXT-4754 Fix for LLEventTimer::updateClass crash.
Ugh. Update on Tofu's patch for this bug.
Reviewed by Richard
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lltimer.cpp | 9 | ||||
-rw-r--r-- | indra/llcommon/lltimer.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 21e165ebc9..900e122ea5 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -560,45 +560,44 @@ void secondsToTimecodeString(F32 current_time, std::string& tcstring) // LLEventTimer Implementation // ////////////////////////////////////////////////////////////////////////////// +bool LLEventTimer::sInTickLoop = false; LLEventTimer::LLEventTimer(F32 period) : mEventTimer() { mPeriod = period; - mBusy = false; } LLEventTimer::LLEventTimer(const LLDate& time) : mEventTimer() { mPeriod = (F32)(time.secondsSinceEpoch() - LLDate::now().secondsSinceEpoch()); - mBusy = false; } LLEventTimer::~LLEventTimer() { - 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. + llassert(!LLEventTimer::sInTickLoop); // 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 void LLEventTimer::updateClass() { std::list<LLEventTimer*> completed_timers; + LLEventTimer::sInTickLoop = true; for (instance_iter iter = beginInstances(); iter != endInstances(); ) { LLEventTimer& timer = *iter++; F32 et = timer.mEventTimer.getElapsedTimeF32(); if (timer.mEventTimer.getStarted() && et > timer.mPeriod) { timer.mEventTimer.reset(); - timer.mBusy = true; if ( timer.tick() ) { completed_timers.push_back( &timer ); } - timer.mBusy = false; } } + LLEventTimer::sInTickLoop = false; if ( completed_timers.size() > 0 ) { diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 4d995d5bba..63e8121b58 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -188,7 +188,7 @@ public: protected: LLTimer mEventTimer; F32 mPeriod; - bool mBusy; + static bool sInTickLoop; }; U64 LL_COMMON_API totalTime(); // Returns current system time in microseconds |