DRTVWR-418: Use conventional LLSingleton init/cleanup for LLWinDebug.

LLWinDebug, though an LLSingleton, had (and required explicit calls to)
special init() and cleanup() methods. Kitty Barnett points out that the
cleanup() method was actually being called after LLSingletonBase::deleteAll(),
requiring resurrection of the deleted LLWinDebug, which sometimes led to
crashes. (Resurrecting deleted LLSingletons is always suspect.)

Change LLWinDebug::init() and cleanup() to the conventional initSingleton()
and cleanupSingleton() methods. This eliminates the need to make special
method calls at all. In particular, cleanupSingleton() will be called by the
existing LLSingletonBase::cleanupAll() call near viewer shutdown.

We retain the early LLWinDebug::instance() call, which implicitly initializes
the LLWinDebug instance, because evidently we want that initialized early. But
we no longer require a separate init() call.
meow-7.2.2
Nat Goodspeed 2017-04-27 08:40:01 -04:00
parent 0d0f2a8aeb
commit c04073da37
3 changed files with 6 additions and 9 deletions

View File

@ -502,7 +502,8 @@ bool LLAppViewerWin32::init()
disableWinErrorReporting();
#ifndef LL_RELEASE_FOR_DOWNLOAD
LLWinDebug::instance().init();
// Merely requesting the LLSingleton instance initializes it.
LLWinDebug::instance();
#endif
#if LL_WINDOWS
@ -526,10 +527,6 @@ bool LLAppViewerWin32::cleanup()
gDXHardware.cleanup();
#ifndef LL_RELEASE_FOR_DOWNLOAD
LLWinDebug::instance().cleanup();
#endif
if (mIsConsoleAllocated)
{
FreeConsole();

View File

@ -90,7 +90,7 @@ LONG NTAPI vectoredHandler(PEXCEPTION_POINTERS exception_infop)
}
// static
void LLWinDebug::init()
void LLWinDebug::initSingleton()
{
static bool s_first_run = true;
// Load the dbghelp dll now, instead of waiting for the crash.
@ -135,7 +135,7 @@ void LLWinDebug::init()
}
}
void LLWinDebug::cleanup ()
void LLWinDebug::cleanupSingleton()
{
gEmergencyMemoryReserve.release();
}

View File

@ -36,9 +36,9 @@ class LLWinDebug:
{
LLSINGLETON_EMPTY_CTOR(LLWinDebug);
public:
static void init();
static void initSingleton();
static void generateMinidump(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL);
static void cleanup();
static void cleanupSingleton();
private:
static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename);
};