diff options
author | Oz Linden <oz@lindenlab.com> | 2010-11-04 11:56:36 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2010-11-04 11:56:36 -0400 |
commit | c97def552af4564d81b68d36a5d7efc2dce56c54 (patch) | |
tree | 73246cf5a4d5963225f611dc35b1f91c216536a5 /indra | |
parent | 7f0de785585876f34366700d43c89514e37b006f (diff) | |
parent | e32ce48d983c3a561dd05dc84eb7b2b7a3b788fb (diff) |
merge fix for STORM-261
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llapp.cpp | 32 | ||||
-rw-r--r-- | indra/llcommon/llapp.h | 6 | ||||
-rw-r--r-- | indra/llimage/llimagedimensionsinfo.cpp | 16 | ||||
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 55 | ||||
-rw-r--r-- | indra/newview/app_settings/cmd_line.xml | 8 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llfolderview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 1 |
8 files changed, 102 insertions, 32 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index eebd5ed0a6..39daefd1ad 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -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. diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index ee1d696829..a536a06ea5 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -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. diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index 5ea4a236b5..835664c60f 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -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; } diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 179b32098a..9d49c1a831 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -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() { diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 00d69f805e..ba3b6a42a4 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -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> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 931b9fd2f3..b17e4d77d5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -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) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index c38cd4d090..62ba746a02 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -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; } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 672213d3e8..598ad7afc6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1199,7 +1199,6 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam const BOOL auto_open = gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false !(asset_type == LLAssetType::AT_CALLINGCARD) && // don't open if it's a calling card - !(item && (item->getInventoryType() == LLInventoryType::IT_ATTACHMENT)) && // don't open if it's an item that's an attachment !from_name.empty(); // don't open if it's not from anyone. LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open); if(active_panel) |