diff options
author | Don Kjer <don@lindenlab.com> | 2007-11-09 01:56:15 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2007-11-09 01:56:15 +0000 |
commit | c1920e3c1c60fb792cf091750b05de618b355878 (patch) | |
tree | 204b78e0f0b87fb2875b90af0f579d53e3138cbb /indra/llcommon/llapp.cpp | |
parent | 760f2ceb1518d87e865f25ac87a540625e974517 (diff) |
EFFECTIVE MERGE: svn merge -r 70833:71458 svn+ssh://svn/svn/linden/branches/maintenance-2 into release
ACTUAL MERGE: svn merge -r 73210:73222 svn+ssh://svn/svn/linden/qa/maintenance-2-merge-73206 into release
Diffstat (limited to 'indra/llcommon/llapp.cpp')
-rw-r--r-- | indra/llcommon/llapp.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index b0751b80e9..2347ac9cd9 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -47,6 +47,7 @@ // #if LL_WINDOWS LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop); +BOOL ConsoleCtrlHandler(DWORD fdwCtrlType); #else #include <unistd.h> // for fork() void setup_signals(); @@ -219,6 +220,11 @@ void LLApp::setupErrorHandling() // Disable this until the viewer gets ported so server crashes can be JIT debugged. //LPTOP_LEVEL_EXCEPTION_FILTER prev_filter; //prev_filter = SetUnhandledExceptionFilter(default_windows_exception_handler); + + // This sets a callback to handle w32 signals to the console window. + // The viewer shouldn't be affected, sicne its a windowed app. + SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ConsoleCtrlHandler, TRUE); + #else // // Start up signal handling. @@ -399,6 +405,34 @@ LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *except return retval; } +// Win32 doesn't support signals. This is used instead. +BOOL ConsoleCtrlHandler(DWORD fdwCtrlType) +{ + switch (fdwCtrlType) + { + case CTRL_BREAK_EVENT: + case CTRL_LOGOFF_EVENT: + case CTRL_SHUTDOWN_EVENT: + case CTRL_CLOSE_EVENT: // From end task or the window close button. + case CTRL_C_EVENT: // from CTRL-C on the keyboard + // Just set our state to quitting, not error + if (LLApp::isQuitting() || LLApp::isError()) + { + // We're already trying to die, just ignore this signal + if (LLApp::sLogInSignal) + { + llinfos << "Signal handler - Already trying to quit, ignoring signal!" << llendl; + } + return TRUE; + } + LLApp::setQuitting(); + return TRUE; + + default: + return FALSE; + } +} + #else //!LL_WINDOWS void LLApp::setChildCallback(pid_t pid, LLAppChildCallback callback) { |