merge fix for STORM-194

meow-7.2.2
Oz Linden 2010-11-04 11:55:10 -04:00
commit e32ce48d98
8 changed files with 103 additions and 31 deletions

View File

@ -575,6 +575,7 @@ Robin Cornelius
SNOW-585
SNOW-599
SNOW-747
STORM-422
VWR-2488
VWR-9557
VWR-11128

View File

@ -90,6 +90,10 @@ S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2;
// the static application instance
LLApp* LLApp::sApplication = NULL;
// Allows the generation of core files for post mortem under gdb
// and disables crashlogger
BOOL LLApp::sDisableCrashlogger = FALSE;
// Local flag for whether or not to do logging in signal handlers.
//static
BOOL LLApp::sLogInSignal = FALSE;
@ -461,11 +465,30 @@ bool LLApp::isQuitting()
return (APP_STATUS_QUITTING == sStatus);
}
// static
bool LLApp::isExiting()
{
return isQuitting() || isError();
}
void LLApp::disableCrashlogger()
{
// Disable Breakpad exception handler.
if (mExceptionHandler != 0)
{
delete mExceptionHandler;
mExceptionHandler = 0;
}
sDisableCrashlogger = TRUE;
}
// static
bool LLApp::isCrashloggerDisabled()
{
return (sDisableCrashlogger == TRUE);
}
#if !LL_WINDOWS
// static
U32 LLApp::getSigChildCount()
@ -799,6 +822,15 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
{
llwarns << "Signal handler - Flagging error status and waiting for shutdown" << llendl;
}
if (LLApp::isCrashloggerDisabled()) // Don't gracefully handle any signal, crash and core for a gdb post mortem
{
clear_signals();
llwarns << "Fatal signal received, not handling the crash here, passing back to operating system" << llendl;
raise(signum);
return;
}
// Flag status to ERROR, so thread_error does its work.
LLApp::setError();
// Block in the signal handler until somebody says that we're done.

View File

@ -189,6 +189,11 @@ public:
//
virtual bool mainLoop() = 0; // Override for the application main loop. Needs to at least gracefully notice the QUITTING state and exit.
//
// Crash logging
//
void disableCrashlogger(); // Let the OS handle the crashes
static bool isCrashloggerDisabled(); // Get the here above set value
//
// Application status
@ -280,6 +285,7 @@ protected:
static void setStatus(EAppStatus status); // Use this to change the application status.
static EAppStatus sStatus; // Reflects current application status
static BOOL sErrorThreadRunning; // Set while the error thread is running
static BOOL sDisableCrashlogger; // Let the OS handle crashes for us.
#if !LL_WINDOWS
static LLAtomicU32* sSigChildCount; // Number of SIGCHLDs received.

View File

@ -30,6 +30,9 @@
#include "llimagedimensionsinfo.h"
// Value is true if one of Libjpeg's functions has encountered an error while working.
static bool sJpegErrorEncountered = false;
bool LLImageDimensionsInfo::load(const std::string& src_filename,U32 codec)
{
clean();
@ -101,9 +104,17 @@ bool LLImageDimensionsInfo::getImageDimensionsPng()
return true;
}
// Called instead of exit() if Libjpeg encounters an error.
void on_jpeg_error(j_common_ptr cinfo)
{
(void) cinfo;
sJpegErrorEncountered = true;
llwarns << "Libjpeg has encountered an error!" << llendl;
}
bool LLImageDimensionsInfo::getImageDimensionsJpeg()
{
sJpegErrorEncountered = false;
clean();
FILE *fp = fopen (mSrcFilename.c_str(), "rb");
if (fp == NULL)
@ -115,6 +126,9 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg()
jpeg_error_mgr jerr;
jpeg_decompress_struct cinfo;
cinfo.err = jpeg_std_error(&jerr);
// Call our function instead of exit() if Libjpeg encounters an error.
// This is done to avoid crash in this case (STORM-472).
cinfo.err->error_exit = on_jpeg_error;
jpeg_create_decompress (&cinfo);
jpeg_stdio_src (&cinfo, fp);
@ -128,6 +142,6 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg()
jpeg_destroy_decompress(&cinfo);
fclose(fp);
return true;
return !sJpegErrorEncountered;
}

View File

@ -456,8 +456,7 @@ BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask)
{
if(y >= (getRect().getHeight() - HEADER_HEIGHT) )
{
LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
header->setFocus(true);
mHeader->setFocus(true);
changeOpenClose(getDisplayChildren());
//reset stored state
@ -509,10 +508,9 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
std::string LLAccordionCtrlTab::getTitle() const
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
return header->getTitle();
return mHeader->getTitle();
}
else
{
@ -522,57 +520,51 @@ std::string LLAccordionCtrlTab::getTitle() const
void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
header->setTitle(title, hl);
mHeader->setTitle(title, hl);
}
}
void LLAccordionCtrlTab::setTitleFontStyle(std::string style)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
header->setTitleFontStyle(style);
mHeader->setTitleFontStyle(style);
}
}
void LLAccordionCtrlTab::setTitleColor(LLUIColor color)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
header->setTitleColor(color);
mHeader->setTitleColor(color);
}
}
boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
return header->setFocusReceivedCallback(cb);
return mHeader->setFocusReceivedCallback(cb);
}
return boost::signals2::connection();
}
boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus_signal_t::slot_type& cb)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
return header->setFocusLostCallback(cb);
return mHeader->setFocusLostCallback(cb);
}
return boost::signals2::connection();
}
void LLAccordionCtrlTab::setSelected(bool is_selected)
{
LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if (header)
if (mHeader)
{
header->setSelected(is_selected);
mHeader->setSelected(is_selected);
}
}
@ -776,8 +768,7 @@ S32 LLAccordionCtrlTab::notify(const LLSD& info)
BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
if( !header->hasFocus() )
if( !mHeader->hasFocus() )
return LLUICtrl::handleKey(key, mask, called_from_parent);
if ( (key == KEY_RETURN )&& mask == MASK_NONE)
@ -830,15 +821,19 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent)
void LLAccordionCtrlTab::showAndFocusHeader()
{
LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
header->setFocus(true);
header->setSelected(mSelectionEnabled);
mHeader->setFocus(true);
mHeader->setSelected(mSelectionEnabled);
LLRect screen_rc;
LLRect selected_rc = header->getRect();
LLRect selected_rc = mHeader->getRect();
localRectToScreen(selected_rc, &screen_rc);
notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
// This call to notifyParent() is intended to deliver "scrollToShowRect" command
// to the parent LLAccordionCtrl so by calling it from the direct parent of this
// accordion tab (assuming that the parent is an LLAccordionCtrl) the calls chain
// is shortened and messages from inside the collapsed tabs are avoided.
// See STORM-536.
getParent()->notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
}
void LLAccordionCtrlTab::storeOpenCloseState()
{

View File

@ -391,5 +391,13 @@
<string>CrashOnStartup</string>
</map>
<key>disablecrashlogger</key>
<map>
<key>desc</key>
<string>Disables the crash logger and lets the OS handle crashes</string>
<key>map-to</key>
<string>DisableCrashLogger</string>
</map>
</map>
</llsd>

View File

@ -2020,6 +2020,15 @@ bool LLAppViewer::initConfiguration()
// - apply command line settings
clp.notify();
// Register the core crash option as soon as we can
// if we want gdb post-mortem on cores we need to be up and running
// ASAP or we might miss init issue etc.
if(clp.hasOption("disablecrashlogger"))
{
llwarns << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << llendl;
LLAppViewer::instance()->disableCrashlogger();
}
// Handle initialization from settings.
// Start up the debugging console before handling other options.
if (gSavedSettings.getBOOL("ShowConsoleWindow"))
@ -2596,6 +2605,11 @@ void LLAppViewer::handleViewerCrash()
abort();
}
if (LLApp::isCrashloggerDisabled())
{
abort();
}
// Returns whether a dialog was shown.
// Only do the logic in here once
if (pApp->mReportedCrash)

View File

@ -2429,6 +2429,7 @@ S32 LLFolderView::notify(const LLSD& info)
{
setFocus(true);
selectFirstItem();
scrollToShowSelection();
return 1;
}
@ -2436,6 +2437,7 @@ S32 LLFolderView::notify(const LLSD& info)
{
setFocus(true);
selectLastItem();
scrollToShowSelection();
return 1;
}
}