diff options
| -rw-r--r-- | indra/llcommon/llerror.cpp | 8 | ||||
| -rw-r--r-- | indra/llcommon/llerror.h | 12 | ||||
| -rw-r--r-- | indra/llinventory/llinventory.cpp | 2 | ||||
| -rw-r--r-- | indra/llinventory/llsaleinfo.cpp | 10 | ||||
| -rw-r--r-- | indra/llui/llnotifications.cpp | 8 | ||||
| -rw-r--r-- | indra/llui/lltransutil.cpp | 2 | ||||
| -rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llappviewer.cpp | 147 | ||||
| -rw-r--r-- | indra/newview/llappviewer.h | 32 | ||||
| -rw-r--r-- | indra/newview/llface.cpp | 23 | ||||
| -rw-r--r-- | indra/newview/lllogininstance.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/lllogininstance.h | 2 | ||||
| -rw-r--r-- | indra/newview/llpanelface.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 35 | ||||
| -rw-r--r-- | indra/newview/llviewertexture.cpp | 2 | 
15 files changed, 260 insertions, 58 deletions
| diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 90c6ba309b..d834098994 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1604,11 +1604,11 @@ namespace LLError      std::string LLUserWarningMsg::sLocalizedOutOfMemoryWarning;      LLUserWarningMsg::Handler LLUserWarningMsg::sHandler; -    void LLUserWarningMsg::show(const std::string& message) +    void LLUserWarningMsg::show(const std::string& message, S32 error_code)      {          if (sHandler)          { -            sHandler(std::string(), message); +            sHandler(std::string(), message, error_code);          }      } @@ -1616,7 +1616,7 @@ namespace LLError      {          if (sHandler && !sLocalizedOutOfMemoryTitle.empty())          { -            sHandler(sLocalizedOutOfMemoryTitle, sLocalizedOutOfMemoryWarning); +            sHandler(sLocalizedOutOfMemoryTitle, sLocalizedOutOfMemoryWarning, ERROR_BAD_ALLOC);          }      } @@ -1627,7 +1627,7 @@ namespace LLError              "Second Life viewer couldn't access some of the files it needs and will be closed."              "\n\nPlease reinstall viewer from  https://secondlife.com/support/downloads/ and "              "contact https://support.secondlife.com if issue persists after reinstall."; -        sHandler("Missing Files", error_string); +        sHandler("Missing Files", error_string, ERROR_MISSING_FILES);      }      void LLUserWarningMsg::setHandler(const LLUserWarningMsg::Handler &handler) diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 8a143ff30a..87625b6ead 100644 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -308,7 +308,15 @@ namespace LLError      class LLUserWarningMsg      {      public: -        typedef std::function<void(const std::string&, const std::string&)> Handler; +        typedef enum +        { +            ERROR_OTHER = 0, +            ERROR_BAD_ALLOC = 1, +            ERROR_MISSING_FILES = 2, +        } eLastExecEvent; + +        // tittle, message and error code to include in error marker file +        typedef std::function<void(const std::string&, const std::string&, S32 error_code)> Handler;          static void setHandler(const Handler&);          static void setOutOfMemoryStrings(const std::string& title, const std::string& message); @@ -316,7 +324,7 @@ namespace LLError          static void showOutOfMemory();          static void showMissingFiles();          // Genering error -        static void show(const std::string&); +        static void show(const std::string&, S32 error_code = -1);      private:          // needs to be preallocated before viewer runs out of memory diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 082d8b2f9f..075abf9536 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -918,7 +918,7 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const      }      //sd[INV_FLAGS_LABEL] = (S32)mFlags;      sd[INV_FLAGS_LABEL] = ll_sd_from_U32(mFlags); -    sd[INV_SALE_INFO_LABEL] = mSaleInfo; +    sd[INV_SALE_INFO_LABEL] = mSaleInfo.asLLSD();      sd[INV_NAME_LABEL] = mName;      sd[INV_DESC_LABEL] = mDescription;      sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index 98836b178e..35bbc1dbb1 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -89,8 +89,14 @@ bool LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const  LLSD LLSaleInfo::asLLSD() const  { -    LLSD sd = LLSD(); -    sd["sale_type"] = lookup(mSaleType); +    LLSD sd; +    const char* type = lookup(mSaleType); +    if (!type) +    { +        LL_WARNS_ONCE() << "Unknown sale type: " << mSaleType << LL_ENDL; +        type = lookup(LLSaleInfo::FS_NOT); +    } +    sd["sale_type"] = type;      sd["sale_price"] = mSalePrice;      return sd;  } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index cd80e7f63f..7405413a3d 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1555,7 +1555,7 @@ bool LLNotifications::loadTemplates()          gDirUtilp->findSkinnedFilenames(LLDir::XUI, "notifications.xml", LLDir::ALL_SKINS);      if (search_paths.empty())      { -        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile")); +        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"), LLError::LLUserWarningMsg::ERROR_MISSING_FILES);          LL_ERRS() << "Problem finding notifications.xml" << LL_ENDL;      } @@ -1565,7 +1565,7 @@ bool LLNotifications::loadTemplates()      if (!success || root.isNull() || !root->hasName( "notifications" ))      { -        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile")); +        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"), LLError::LLUserWarningMsg::ERROR_MISSING_FILES);          LL_ERRS() << "Problem reading XML from UI Notifications file: " << base_filename << LL_ENDL;          return false;      } @@ -1576,7 +1576,7 @@ bool LLNotifications::loadTemplates()      if(!params.validateBlock())      { -        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile")); +        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"), LLError::LLUserWarningMsg::ERROR_MISSING_FILES);          LL_ERRS() << "Problem reading XUI from UI Notifications file: " << base_filename << LL_ENDL;          return false;      } @@ -1643,7 +1643,7 @@ bool LLNotifications::loadVisibilityRules()      if(!params.validateBlock())      { -        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile")); +        LLError::LLUserWarningMsg::show(LLTrans::getString("MBMissingFile"), LLError::LLUserWarningMsg::ERROR_MISSING_FILES);          LL_ERRS() << "Problem reading UI Notification Visibility Rules file: " << full_filename << LL_ENDL;          return false;      } diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 4af5376a8b..e82af0b96f 100644 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp @@ -48,7 +48,7 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<s              "Second Life viewer couldn't access some of the files it needs and will be closed."              "\n\nPlease reinstall viewer from  https://secondlife.com/support/downloads/ and "              "contact https://support.secondlife.com if issue persists after reinstall."; -        LLError::LLUserWarningMsg::show(error_string); +        LLError::LLUserWarningMsg::show(error_string, LLError::LLUserWarningMsg::ERROR_MISSING_FILES);          gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);          LL_ERRS() << "Couldn't load string table " << xml_filename << " " << errno << LL_ENDL;          return false; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index fe2224b845..bc39e7f6f7 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1307,8 +1307,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo      catch (...)      {          LOG_UNHANDLED_EXCEPTION("ChoosePixelFormat"); -        OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), -            mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBPixelFmtErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1319,8 +1318,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo      if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),          &pfd))      { -        OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), -            mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBPixelFmtDescErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1358,8 +1356,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo      if (!SetPixelFormat(mhDC, pixel_format, &pfd))      { -        OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), -            mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBPixelFmtSetErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1367,16 +1364,14 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo      if (!(mhRC = SafeCreateContext(mhDC)))      { -        OSMessageBox(mCallbacks->translateString("MBGLContextErr"), -            mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBGLContextErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      }      if (!wglMakeCurrent(mhDC, mhRC))      { -        OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), -            mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBGLContextActErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1582,15 +1577,14 @@ const   S32   max_format  = (S32)num_formats - 1;          if (!mhDC)          { -            OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); +            LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBDevContextErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);              close();              return false;          }          if (!SetPixelFormat(mhDC, pixel_format, &pfd))          { -            OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), -                mCallbacks->translateString("MBError"), OSMB_OK); +            LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBPixelFmtSetErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);              close();              return false;          } @@ -1622,7 +1616,7 @@ const   S32   max_format  = (S32)num_formats - 1;      {          LL_WARNS("Window") << "No wgl_ARB_pixel_format extension!" << LL_ENDL;          // cannot proceed without wgl_ARB_pixel_format extension, shutdown same as any other gGLManager.initGL() failure -        OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBVideoDrvErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1631,7 +1625,7 @@ const   S32   max_format  = (S32)num_formats - 1;      if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),          &pfd))      { -        OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBPixelFmtDescErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1653,14 +1647,14 @@ const   S32   max_format  = (S32)num_formats - 1;      if (!wglMakeCurrent(mhDC, mhRC))      { -        OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBGLContextActErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      }      if (!gGLManager.initGL())      { -        OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBVideoDrvErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);          close();          return false;      } @@ -1865,7 +1859,7 @@ void* LLWindowWin32::createSharedContext()      if (!rc && !(rc = wglCreateContext(mhDC)))      {          close(); -        OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); +        LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBGLContextErr"), 8/*LAST_EXEC_GRAPHICS_INIT*/);      }      return rc; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7c040a3ca1..435b2b7692 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -305,6 +305,7 @@ bool gUseQuickTime = true;  eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL;  S32 gLastExecDuration = -1; // (<0 indicates unknown) +LLUUID gLastAgentSessionId;  #if LL_WINDOWS  #   define LL_PLATFORM_KEY "win" @@ -2280,12 +2281,26 @@ void errorCallback(LLError::ELevel level, const std::string &error_string)      }  } -void errorMSG(const std::string& title_string, const std::string& message_string) +void errorHandler(const std::string& title_string, const std::string& message_string, S32 code)  {      if (!message_string.empty())      {          OSMessageBox(message_string, title_string.empty() ? LLTrans::getString("MBFatalError") : title_string, OSMB_OK);      } +    switch (code) +    { +    case LLError::LLUserWarningMsg::ERROR_OTHER: +        LLAppViewer::instance()->createErrorMarker(LAST_EXEC_OTHER_CRASH); +        break; +    case LLError::LLUserWarningMsg::ERROR_BAD_ALLOC: +        LLAppViewer::instance()->createErrorMarker(LAST_EXEC_BAD_ALLOC); +        break; +    case LLError::LLUserWarningMsg::ERROR_MISSING_FILES: +        LLAppViewer::instance()->createErrorMarker(LAST_EXEC_MISSING_FILES); +        break; +    default: +        break; +    }  }  void LLAppViewer::initLoggingAndGetLastDuration() @@ -2299,7 +2314,7 @@ void LLAppViewer::initLoggingAndGetLastDuration()      LLError::addGenericRecorder(&errorCallback);      //LLError::setTimeFunction(getRuntime); -    LLError::LLUserWarningMsg::setHandler(errorMSG); +    LLError::LLUserWarningMsg::setHandler(errorHandler);      if (mSecondInstance) @@ -2591,6 +2606,7 @@ bool LLAppViewer::initConfiguration()          OSMessageBox(              "Unable to load default settings file. The installation may be corrupted.",              LLStringUtil::null,OSMB_OK); +        LLAppViewer::instance()->createErrorMarker(LAST_EXEC_MISSING_FILES);          return false;      } @@ -3755,16 +3771,21 @@ bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const      bool sameVersion = false;      std::string my_version(LLVersionInfo::instance().getChannelAndVersion()); -    char marker_version[MAX_MARKER_LENGTH]; +    char marker_data[MAX_MARKER_LENGTH];      S32  marker_version_length;      LLAPRFile marker_file;      marker_file.open(marker_name, LL_APR_RB);      if (marker_file.getFileHandle())      { -        marker_version_length = marker_file.read(marker_version, sizeof(marker_version)); -        std::string marker_string(marker_version, marker_version_length); -        if ( 0 == my_version.compare( 0, my_version.length(), marker_version, 0, marker_version_length ) ) +        marker_version_length = marker_file.read(marker_data, sizeof(marker_data)); +        std::string marker_string(marker_data, marker_version_length); +        size_t pos = marker_string.find('\n'); +        if (pos != std::string::npos) +        { +            marker_string = marker_string.substr(0, pos); +        } +        if ( 0 == my_version.compare( 0, my_version.length(), marker_string, 0, marker_string.length()) )          {              sameVersion = true;          } @@ -3778,6 +3799,88 @@ bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const      return sameVersion;  } +void LLAppViewer::recordSessionToMarker() +{ +    std::string marker_version(LLVersionInfo::instance().getChannelAndVersion()); +    std::string uuid_str = "\n" + gAgentSessionID.asString(); +    if (marker_version.length() + uuid_str.length() > MAX_MARKER_LENGTH) +    { +        LL_WARNS_ONCE("MarkerFile") << "Version length (" << marker_version.length() << ")" +            << " greater than maximum (" << MAX_MARKER_LENGTH << ")" +            << ": marker matching may be incorrect" +            << LL_ENDL; +    } + +    mMarkerFile.seek(APR_SET, (S32)marker_version.length()); +    mMarkerFile.write(uuid_str.data(), (S32)uuid_str.length()); +} + +LLUUID LLAppViewer::getMarkerSessionId(const std::string& marker_name) const +{ +    std::string data; +    if (getMarkerData(marker_name, data)) +    { +        return LLUUID(data); +    } +    return LLUUID(); +} + +S32 LLAppViewer::getMarkerErrorCode(const std::string& marker_name) const +{ +    std::string data; +    if (getMarkerData(marker_name, data)) +    { +        if (data.empty()) +        { +            return 0; +        } +        else +        { +            return std::stoi(data); +        } +    } +    return -1; +} + +bool LLAppViewer::getMarkerData(const std::string& marker_name, std::string& data) const +{ +    bool sameVersion = false; + +    std::string my_version(LLVersionInfo::instance().getChannelAndVersion()); +    char marker_data[MAX_MARKER_LENGTH]; +    S32  marker_version_length; + +    LLAPRFile marker_file; +    marker_file.open(marker_name, LL_APR_RB); +    if (marker_file.getFileHandle()) +    { +        marker_version_length = marker_file.read(marker_data, sizeof(marker_data)); +        marker_file.close(); +        std::string marker_string(marker_data, marker_version_length); +        size_t pos = marker_string.find('\n'); +        if (pos != std::string::npos) +        { +            data = marker_string.substr(pos + 1, marker_version_length - pos - 1); +            marker_string = marker_string.substr(0, pos); +        } +        if (0 == my_version.compare(0, my_version.length(), marker_string, 0, marker_string.length())) +        { +            sameVersion = true; +        } +        else +        { +            return false; +        } +        LL_DEBUGS("MarkerFile") << "Compare markers for '" << marker_name << "': " +            << "\n   mine '" << my_version << "'" +            << "\n marker '" << marker_string << "'" +            << "\n " << (sameVersion ? "same" : "different") << " version" +            << LL_ENDL; +        return true; +    } +    return false; +} +  void LLAppViewer::processMarkerFiles()  {      //We've got 4 things to test for here @@ -3796,6 +3899,10 @@ void LLAppViewer::processMarkerFiles()          // File exists...          // first, read it to see if it was created by the same version (we need this later)          marker_is_same_version = markerIsSameVersion(mMarkerFileName); +        if (marker_is_same_version) +        { +            gLastAgentSessionId = getMarkerSessionId(mMarkerFileName); +        }          // now test to see if this file is locked by a running process (try to open for write)          marker_log_stream << "Checking exec marker file for lock..."; @@ -3912,17 +4019,23 @@ void LLAppViewer::processMarkerFiles()      std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);      if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))      { -        if (markerIsSameVersion(error_marker_file)) +        S32 marker_code = getMarkerErrorCode(error_marker_file); +        if (marker_code >= 0)          {              if (gLastExecEvent == LAST_EXEC_LOGOUT_FROZE)              {                  gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;                  LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to LOGOUT_CRASH" << LL_ENDL;              } +            else if (marker_code > 0 && marker_code < (S32)LAST_EXEC_COUNT) +            { +                gLastExecEvent = (eLastExecEvent)marker_code; +                LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL; +            }              else              {                  gLastExecEvent = LAST_EXEC_OTHER_CRASH; -                LL_INFOS("MarkerFile") << "Error marker '"<< error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL; +                LL_INFOS("MarkerFile") << "Error marker '" << error_marker_file << "' crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;              }          }          else @@ -5212,6 +5325,24 @@ void LLAppViewer::postToMainCoro(const LL::WorkQueue::Work& work)      gMainloopWork.post(work);  } +void LLAppViewer::createErrorMarker(eLastExecEvent error_code) const +{ +    if (!mSecondInstance) +    { +        std::string error_marker = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); + +        LLAPRFile file; +        file.open(error_marker, LL_APR_WB); +        if (file.getFileHandle()) +        { +            recordMarkerVersion(file); +            std::string data = "\n" + std::to_string((S32)error_code); +            file.write(data.data(), static_cast<S32>(data.length())); +            file.close(); +        } +    } +} +  void LLAppViewer::outOfMemorySoftQuit()  {      if (!mQuitRequested) diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 4ce4259ed8..b4756eecd6 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -66,6 +66,20 @@ class LLViewerRegion;  extern LLTrace::BlockTimerStatHandle FTM_FRAME; +typedef enum +{ +    LAST_EXEC_NORMAL = 0, +    LAST_EXEC_FROZE, +    LAST_EXEC_LLERROR_CRASH, +    LAST_EXEC_OTHER_CRASH, +    LAST_EXEC_LOGOUT_FROZE, +    LAST_EXEC_LOGOUT_CRASH, +    LAST_EXEC_BAD_ALLOC, +    LAST_EXEC_MISSING_FILES, +    LAST_EXEC_GRAPHICS_INIT, +    LAST_EXEC_COUNT +} eLastExecEvent; +  class LLAppViewer : public LLApp  {  public: @@ -147,6 +161,7 @@ public:      void saveExperienceCache();      void removeMarkerFiles(); +    void recordSessionToMarker();      void removeDumpDir();      // LLAppViewer testing helpers. @@ -227,6 +242,9 @@ public:      // post given work to the "mainloop" work queue for handling on the main thread      void postToMainCoro(const LL::WorkQueue::Work& work); +    // Writes an error code into the error_marker file for use on next startup. +    void createErrorMarker(eLastExecEvent error_code) const; +      // Attempt a 'soft' quit with disconnect and saving of settings/cache.      // Intended to be thread safe.      // Good chance of viewer crashing either way, but better than alternatives. @@ -272,6 +290,9 @@ private:      void processMarkerFiles();      static void recordMarkerVersion(LLAPRFile& marker_file);      bool markerIsSameVersion(const std::string& marker_name) const; +    LLUUID getMarkerSessionId(const std::string& marker_name) const; +    S32 getMarkerErrorCode(const std::string& marker_name) const; +    bool getMarkerData(const std::string& marker_name, std::string &data) const;      void idle();      void idleShutdown(); @@ -347,18 +368,9 @@ private:  extern LLSD gDebugInfo;  extern bool gShowObjectUpdates; -typedef enum -{ -    LAST_EXEC_NORMAL = 0, -    LAST_EXEC_FROZE, -    LAST_EXEC_LLERROR_CRASH, -    LAST_EXEC_OTHER_CRASH, -    LAST_EXEC_LOGOUT_FROZE, -    LAST_EXEC_LOGOUT_CRASH -} eLastExecEvent; -  extern eLastExecEvent gLastExecEvent; // llstartup  extern S32 gLastExecDuration; ///< the duration of the previous run in seconds (<0 indicates unknown) +extern LLUUID gLastAgentSessionId; // will be set if agent logged in  extern const char* gPlatform; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index e06127c1c8..85f902db8d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -896,7 +896,7 @@ LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, const LLVector4a& po      //VECTORIZE THIS      // see if we have a non-default mapping -    U8 texgen = getTextureEntry()->getTexGen(); +    U8 texgen = tep->getTexGen();      if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)      {          LLVector4a& center = *(mDrawablep->getVOVolume()->getVolume()->getVolumeFace(mTEOffset).mCenter); @@ -986,8 +986,17 @@ bool LLFace::calcAlignedPlanarTE(const LLFace* align_to,  LLVector2* res_st_offs          return false;      }      const LLTextureEntry *orig_tep = align_to->getTextureEntry(); +    if (!orig_tep) +    { +        return false; +    } +    const LLTextureEntry* tep = getTextureEntry(); +    if (!tep) +    { +        return false; +    }      if ((orig_tep->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR) || -        (getTextureEntry()->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR)) +        (tep->getTexGen() != LLTextureEntry::TEX_GEN_PLANAR))      {          return false;      } @@ -1566,7 +1575,8 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,                  bump_t_primary_light_ray.load3((offset_multiple * t_scale * primary_light_ray).mV);              } -            U8 texgen = getTextureEntry()->getTexGen(); +            const LLTextureEntry* tep = getTextureEntry(); +            U8 texgen = tep ? tep->getTexGen() : LLTextureEntry::TEX_GEN_DEFAULT;              if (rebuild_tcoord && texgen != LLTextureEntry::TEX_GEN_DEFAULT)              { //planar texgen needs binormals                  mVObjp->getVolume()->genTangents(face_index); @@ -2054,7 +2064,12 @@ bool LLFace::getGeometryVolume(const LLVolume& volume,              LLStrider<LLColor4U> emissive;              mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount); -            U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255); +            const LLTextureEntry* tep = getTextureEntry(); +            U8 glow = 0; +            if (tep) +            { +                glow = (U8)llclamp((S32)(tep->getGlow() * 255), 0, 255); +            }              LLVector4a src; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index ad04c11cc6..cbc3744aa3 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -212,6 +212,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia      request_params["read_critical"] = false; // handleTOSResponse      request_params["last_exec_event"] = mLastExecEvent;      request_params["last_exec_duration"] = mLastExecDuration; +    request_params["last_exec_session_id"] = mLastAgentSessionId.asString();      request_params["mac"] = (char*)hashed_unique_id_string;      request_params["version"] = LLVersionInfo::instance().getVersion();      request_params["channel"] = LLVersionInfo::instance().getChannel(); diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 624408d46d..748909c069 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -64,6 +64,7 @@ public:      void setSerialNumber(const std::string& sn) { mSerialNumber = sn; }      void setLastExecEvent(int lee) { mLastExecEvent = lee; }      void setLastExecDuration(S32 duration) { mLastExecDuration = duration; } +    void setLastAgentSessionId(const LLUUID& id) { mLastAgentSessionId = id; }      void setPlatformInfo(const std::string platform, const std::string platform_version, const std::string platform_name);      void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; } @@ -101,6 +102,7 @@ private:      std::string mSerialNumber;      int mLastExecEvent;      S32 mLastExecDuration; +    LLUUID mLastAgentSessionId;      std::string mPlatform;      std::string mPlatformVersion;      std::string mPlatformVersionName; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b07946dd5d..74fb2f0f93 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -898,6 +898,10 @@ struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor          if (facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot))          {              const LLTextureEntry* tep = facep->getTextureEntry(); +            if (!tep) +            { +                return false; +            }              LLVector2 st_offset, st_scale;              tep->getOffset(&st_offset.mV[VX], &st_offset.mV[VY]);              tep->getScale(&st_scale.mV[VX], &st_scale.mV[VY]); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3a7aaaeca1..6bf203c140 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1072,6 +1072,7 @@ bool idle_startup()          login->setSerialNumber(LLAppViewer::instance()->getSerialNumber());          login->setLastExecEvent(gLastExecEvent);          login->setLastExecDuration(gLastExecDuration); +        login->setLastAgentSessionId(gLastAgentSessionId);          // This call to LLLoginInstance::connect() starts the          // authentication process. @@ -1420,7 +1421,7 @@ bool idle_startup()          }          else if (regionp->capabilitiesError())          { -            LL_WARNS("AppInit") << "Failed to get capabilities. Backing up to login screen!" << LL_ENDL; +            LL_WARNS("AppInit") << "Failed to get capabilities. Logging out and backing up to login screen!" << LL_ENDL;              if (gRememberPassword)              {                  LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status); @@ -1429,6 +1430,15 @@ bool idle_startup()              {                  LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);              } + +            // Session was created, don't just hang up on server, send a logout request +            LLMessageSystem* msg = gMessageSystem; +            msg->newMessageFast(_PREHASH_LogoutRequest); +            msg->nextBlockFast(_PREHASH_AgentData); +            msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); +            msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); +            gAgent.sendReliableMessage(); +              reset_login();          }          else @@ -1436,7 +1446,7 @@ bool idle_startup()              U32 num_retries = regionp->getNumSeedCapRetries();              if (num_retries > MAX_SEED_CAP_ATTEMPTS_BEFORE_ABORT)              { -                LL_WARNS("AppInit") << "Failed to get capabilities. Backing up to login screen!" << LL_ENDL; +                LL_WARNS("AppInit") << "Failed to get capabilities. Logging out and backing up to login screen!" << LL_ENDL;                  if (gRememberPassword)                  {                      LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status); @@ -1445,6 +1455,15 @@ bool idle_startup()                  {                      LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);                  } + +                // Session was created, don't just hang up on server, send a logout request +                LLMessageSystem* msg = gMessageSystem; +                msg->newMessageFast(_PREHASH_LogoutRequest); +                msg->nextBlockFast(_PREHASH_AgentData); +                msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); +                msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); +                gAgent.sendReliableMessage(); +                  reset_login();              }              else if (num_retries > 0) @@ -1747,7 +1766,7 @@ bool idle_startup()          if (!gAgentMovementCompleted && timeout.getElapsedTimeF32() > STATE_AGENT_WAIT_TIMEOUT)          { -            LL_WARNS("AppInit") << "Backing up to login screen!" << LL_ENDL; +            LL_WARNS("AppInit") << "Timeout on agent movement. Sending logout and backing up to login screen!" << LL_ENDL;              if (gRememberPassword)              {                  LLNotificationsUtil::add("LoginPacketNeverReceived", LLSD(), LLSD(), login_alert_status); @@ -1756,6 +1775,15 @@ bool idle_startup()              {                  LLNotificationsUtil::add("LoginPacketNeverReceivedNoTP", LLSD(), LLSD(), login_alert_status);              } + +            // Session was created, don't just hang up on server, send a logout request +            LLMessageSystem* msg = gMessageSystem; +            msg->newMessageFast(_PREHASH_LogoutRequest); +            msg->nextBlockFast(_PREHASH_AgentData); +            msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); +            msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); +            gAgent.sendReliableMessage(); +              reset_login();          }          return false; @@ -3564,6 +3592,7 @@ bool process_login_success_response()      text = response["session_id"].asString();      if(!text.empty()) gAgentSessionID.set(text);      gDebugInfo["SessionID"] = text; +    LLAppViewer::instance()->recordSessionToMarker();      // Session id needed for parcel info request in LLUrlEntryParcel      // to resolve parcel name. diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 2eaadd9e71..4996ae1c96 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3553,7 +3553,7 @@ void LLViewerMediaTexture::setPlaying(bool playing)          {              LLFace* facep = *iter;              const LLTextureEntry* te = facep->getTextureEntry(); -            if (te->getGLTFMaterial()) +            if (te && te->getGLTFMaterial())              {                  // PBR material, switch emissive and basecolor                  switchTexture(LLRender::EMISSIVE_MAP, *iter); | 
