SH-4653 FIX Interesting: Viewer crashes while reading chat history

master
Richard Linden 2013-12-10 12:50:23 -08:00
parent 8d5605e09f
commit d4f3fe3c56
4 changed files with 13 additions and 3 deletions

View File

@ -37,7 +37,7 @@
#include "llvisualparam.h"
#include "llstringtable.h"
#include "llpointer.h"
#include "llthread.h"
#include "llrefcount.h"
class LLPolyMesh;

View File

@ -132,7 +132,7 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
#endif
// for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread
LLTrace::ThreadRecorder thread_recorder(*LLTrace::get_master_thread_recorder());
mRecorder = new LLTrace::ThreadRecorder(*LLTrace::get_master_thread_recorder());
#if !LL_DARWIN
sThreadID = threadp->mID;
@ -222,6 +222,8 @@ void LLThread::shutdown()
// This thread just wouldn't stop, even though we gave it time
//LL_WARNS() << "LLThread::~LLThread() exiting thread before clean exit!" << LL_ENDL;
// Put a stake in its heart.
delete mRecorder;
apr_thread_exit(mAPRThreadp, -1);
return;
}
@ -239,6 +241,8 @@ void LLThread::shutdown()
apr_pool_destroy(mAPRPoolp);
mAPRPoolp = 0;
}
delete mRecorder;
}

View File

@ -36,6 +36,11 @@
LL_COMMON_API void assert_main_thread();
namespace LLTrace
{
class ThreadRecorder;
}
class LL_COMMON_API LLThread
{
private:
@ -105,6 +110,7 @@ protected:
BOOL mIsLocalPool;
EThreadStatus mStatus;
U32 mID;
LLTrace::ThreadRecorder* mRecorder;
//a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used.
//Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes.

View File

@ -40,7 +40,7 @@ StatBase::StatBase( const char* name, const char* description )
mDescription(description ? description : "")
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
if (LLTrace::get_thread_recorder() != NULL)
if (LLTrace::get_thread_recorder().notNull())
{
LL_ERRS() << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << LL_ENDL;
}