diff options
author | Richard Linden <none@none> | 2014-01-10 13:56:35 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2014-01-10 13:56:35 -0800 |
commit | a712aab616b13a9887e00b5d37714f02d7fde6a0 (patch) | |
tree | bd7b0474872479b6b5b5ff820e53fc3fd48ee15f /indra/llcommon/lltracethreadrecorder.cpp | |
parent | 3455bf958908037e6d8fcb2956d2cebcdee6ae2d (diff) |
added some defensive asserts in lltrace to make cases of misuse more obvious when it crashes
Diffstat (limited to 'indra/llcommon/lltracethreadrecorder.cpp')
-rw-r--r-- | indra/llcommon/lltracethreadrecorder.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index a14a8ff035..187d8546d3 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -191,25 +191,25 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording ) { active_recording_list_t::iterator recording_it = bringUpToDate(recording); - if (recording_it != mActiveRecordings.end()) + // this method should only be called on a thread where the recorder is active + llassert_always(recording_it != mActiveRecordings.end()); + + ActiveRecording* recording_to_remove = *recording_it; + bool was_current = recording_to_remove->mPartialRecording.isCurrent(); + llassert(recording_to_remove->mTargetRecording == recording); + mActiveRecordings.erase(recording_it); + if (was_current) { - ActiveRecording* recording_to_remove = *recording_it; - bool was_current = recording_to_remove->mPartialRecording.isCurrent(); - llassert(recording_to_remove->mTargetRecording == recording); - mActiveRecordings.erase(recording_it); - if (was_current) + if (mActiveRecordings.empty()) { - if (mActiveRecordings.empty()) - { - AccumulatorBufferGroup::clearCurrent(); - } - else - { - mActiveRecordings.back()->mPartialRecording.makeCurrent(); - } + AccumulatorBufferGroup::clearCurrent(); + } + else + { + mActiveRecordings.back()->mPartialRecording.makeCurrent(); } - delete recording_to_remove; } + delete recording_to_remove; } ThreadRecorder::ActiveRecording::ActiveRecording( AccumulatorBufferGroup* target ) |