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/lltracerecording.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/lltracerecording.cpp')
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index cd837c0867..d6232d771d 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -88,6 +88,9 @@ Recording::~Recording() disclaim_alloc(gTraceMemStat, this); disclaim_alloc(gTraceMemStat, mBuffers); + // allow recording destruction without thread recorder running, + // otherwise thread shutdown could crash if a recording outlives the thread recorder + // besides, recording construction and destruction is fine without a recorder...just don't attempt to start one if (isStarted() && LLTrace::get_thread_recorder().notNull()) { LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); @@ -101,7 +104,10 @@ void Recording::update() { mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); - llassert(mActiveBuffers); + // must have + llassert(mActiveBuffers != NULL + && LLTrace::get_thread_recorder().notNull()); + if(!mActiveBuffers->isCurrent()) { AccumulatorBufferGroup* buffers = mBuffers.write(); @@ -125,12 +131,16 @@ void Recording::handleStart() { mSamplingTimer.reset(); mBuffers.setStayUnique(true); + // must have thread recorder running on this thread + llassert(LLTrace::get_thread_recorder().notNull()); mActiveBuffers = LLTrace::get_thread_recorder()->activate(mBuffers.write()); } void Recording::handleStop() { mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); + // must have thread recorder running on this thread + llassert(LLTrace::get_thread_recorder().notNull()); LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); mActiveBuffers = NULL; mBuffers.setStayUnique(false); |