diff options
| author | Erik Kundiman <erik@megapahit.org> | 2025-04-09 12:37:41 +0800 | 
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2025-04-09 12:37:41 +0800 | 
| commit | 381fecfd3e6f724ba0d3ae73ff6b1645521681e9 (patch) | |
| tree | 19d621c92d8ecdeae7cbea3b6bedbc367febf9bb /indra | |
| parent | 38e93309358700deb15b6b32b6395d1bc08e5525 (diff) | |
| parent | 632a8648ca5456448499a96dcc58c40f4ff80d95 (diff) | |
Merge tag 'Second_Life_Release#632a8648-2025.03' into 2025.03
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llkdu/llimagej2ckdu.cpp | 183 | ||||
| -rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/featuretable.txt | 2 | ||||
| -rw-r--r-- | indra/newview/featuretable_mac.txt | 2 | ||||
| -rw-r--r-- | indra/newview/gltfscenemanager.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llcallingcard.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/lldrawable.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/lleventpoll.cpp | 14 | ||||
| -rw-r--r-- | indra/newview/lllocalbitmaps.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llmaterialeditor.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/lltoast.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.h | 2 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.cpp | 9 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.h | 4 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 10 | 
16 files changed, 187 insertions, 99 deletions
| diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index bf7cfbe071..0d1f2b3006 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -279,103 +279,118 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod  {      LLImageDataLock lock(&base); -    S32 data_size = base.getDataSize(); -    S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); +    try +    { -    // -    //  Initialization -    // -    mCodeStreamp.reset(); +        S32 data_size = base.getDataSize(); +        S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); -    // It's not clear to nat under what circumstances we would reuse a -    // pre-existing LLKDUMemSource instance. As of 2016-08-05, it consists of -    // two U32s and a pointer, so it's not as if it would be a huge overhead -    // to allocate a new one every time. -    // Also -- why is base.getData() tested specifically here? If that returns -    // NULL, shouldn't we bail out of the whole method? -    if (!mInputp && base.getData()) -    { -        // The compressed data has been loaded -        // Setup the source for the codestream -        mInputp.reset(new LLKDUMemSource(base.getData(), data_size)); -    } +        // +        //  Initialization +        // +        mCodeStreamp.reset(); -    if (mInputp) -    { -        // This is LLKDUMemSource::reset(), not boost::scoped_ptr::reset(). -        mInputp->reset(); -    } +        // It's not clear to nat under what circumstances we would reuse a +        // pre-existing LLKDUMemSource instance. As of 2016-08-05, it consists of +        // two U32s and a pointer, so it's not as if it would be a huge overhead +        // to allocate a new one every time. +        // Also -- why is base.getData() tested specifically here? If that returns +        // NULL, shouldn't we bail out of the whole method? +        if (!mInputp && base.getData()) +        { +            // The compressed data has been loaded +            // Setup the source for the codestream +            mInputp.reset(new LLKDUMemSource(base.getData(), data_size)); +        } -    mCodeStreamp->create(mInputp.get()); - -    // Set the maximum number of bytes to use from the codestream -    // *TODO: This seems to be wrong. The base class should have no idea of -    // how j2c compression works so no good way of computing what's the byte -    // range to be used. -    mCodeStreamp->set_max_bytes(max_bytes,true); - -    //  If you want to flip or rotate the image for some reason, change -    // the resolution, or identify a restricted region of interest, this is -    // the place to do it.  You may use "kdu_codestream::change_appearance" -    // and "kdu_codestream::apply_input_restrictions" for this purpose. -    //  If you wish to truncate the code-stream prior to decompression, you -    // may use "kdu_codestream::set_max_bytes". -    //  If you wish to retain all compressed data so that the material -    // can be decompressed multiple times, possibly with different appearance -    // parameters, you should call "kdu_codestream::set_persistent" here. -    //  There are a variety of other features which must be enabled at -    // this point if you want to take advantage of them.  See the -    // descriptions appearing with the "kdu_codestream" interface functions -    // in "kdu_compressed.h" for an itemized account of these capabilities. - -    switch (mode) -    { -    case MODE_FAST: -        mCodeStreamp->set_fast(); -        break; -    case MODE_RESILIENT: -        mCodeStreamp->set_resilient(); -        break; -    case MODE_FUSSY: -        mCodeStreamp->set_fussy(); -        break; -    default: -        llassert(0); -        mCodeStreamp->set_fast(); -    } +        if (mInputp) +        { +            // This is LLKDUMemSource::reset(), not boost::scoped_ptr::reset(). +            mInputp->reset(); +        } -    kdu_dims dims; -    mCodeStreamp->get_dims(0,dims); +        mCodeStreamp->create(mInputp.get()); + +        // Set the maximum number of bytes to use from the codestream +        // *TODO: This seems to be wrong. The base class should have no idea of +        // how j2c compression works so no good way of computing what's the byte +        // range to be used. +        mCodeStreamp->set_max_bytes(max_bytes, true); + +        //  If you want to flip or rotate the image for some reason, change +        // the resolution, or identify a restricted region of interest, this is +        // the place to do it.  You may use "kdu_codestream::change_appearance" +        // and "kdu_codestream::apply_input_restrictions" for this purpose. +        //  If you wish to truncate the code-stream prior to decompression, you +        // may use "kdu_codestream::set_max_bytes". +        //  If you wish to retain all compressed data so that the material +        // can be decompressed multiple times, possibly with different appearance +        // parameters, you should call "kdu_codestream::set_persistent" here. +        //  There are a variety of other features which must be enabled at +        // this point if you want to take advantage of them.  See the +        // descriptions appearing with the "kdu_codestream" interface functions +        // in "kdu_compressed.h" for an itemized account of these capabilities. + +        switch (mode) +        { +        case MODE_FAST: +            mCodeStreamp->set_fast(); +            break; +        case MODE_RESILIENT: +            mCodeStreamp->set_resilient(); +            break; +        case MODE_FUSSY: +            mCodeStreamp->set_fussy(); +            break; +        default: +            llassert(0); +            mCodeStreamp->set_fast(); +        } + +        kdu_dims dims; +        mCodeStreamp->get_dims(0, dims); -    S32 components = mCodeStreamp->get_num_components(); +        S32 components = mCodeStreamp->get_num_components(); -    // Check that components have consistent dimensions (for PPM file) -    for (int idx = 1; idx < components; ++idx) -    { -        kdu_dims other_dims; -        mCodeStreamp->get_dims(idx, other_dims); -        if (other_dims != dims) +        // Check that components have consistent dimensions (for PPM file) +        for (int idx = 1; idx < components; ++idx)          { -            // This method is only called from methods that catch KDUError. -            // We want to fail the image load, not crash the viewer. -            LLTHROW(KDUError(STRINGIZE("Component " << idx << " dimensions " -                                       << stringize(other_dims) -                                       << " do not match component 0 dimensions " -                                       << stringize(dims) << "!"))); +            kdu_dims other_dims; +            mCodeStreamp->get_dims(idx, other_dims); +            if (other_dims != dims) +            { +                // This method is only called from methods that catch KDUError. +                // We want to fail the image load, not crash the viewer. +                LLTHROW(KDUError(STRINGIZE("Component " << idx << " dimensions " +                    << stringize(other_dims) +                    << " do not match component 0 dimensions " +                    << stringize(dims) << "!"))); +            }          } -    } -    // Get the number of resolution levels in that image -    mLevels = mCodeStreamp->get_min_dwt_levels(); +        // Get the number of resolution levels in that image +        mLevels = mCodeStreamp->get_min_dwt_levels(); -    // Set the base dimensions -    base.setSize(dims.size.x, dims.size.y, components); -    base.setLevels(mLevels); +        // Set the base dimensions +        base.setSize(dims.size.x, dims.size.y, components); +        base.setLevels(mLevels); -    if (!keep_codestream) +        if (!keep_codestream) +        { +            mCodeStreamp.reset(); +            mInputp.reset(); +        } +    } +    catch (std::bad_alloc&)      { -        mCodeStreamp.reset(); -        mInputp.reset(); +        // we are in a thread, can't show an 'out of memory' here, +        // main thread will keep going +        throw; +    } +    catch (...) +    { +        LLTHROW(KDUError(STRINGIZE("Unknown J2C error : " + +            boost::current_exception_diagnostic_information() << "!")));      }  } diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 557af1b158..730e658c6a 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4029,7 +4029,15 @@ void LLWindowWin32::fillCompositionLogfont(LOGFONT *logfont)          break;      } -    logfont->lfHeight = mPreeditor->getPreeditFontSize(); +    if (mPreeditor) +    { +        logfont->lfHeight = mPreeditor->getPreeditFontSize(); +    } +    else +    { +        // todo: extract from some font * LLUI::getScaleFactor() intead +        logfont->lfHeight = 10; +    }      logfont->lfWeight = FW_NORMAL;  } diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index c0009d24ee..1090dd8ffb 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 73 +version 74  // The version number above should be incremented IF AND ONLY IF some  // change has been made that is sufficiently important to justify  // resetting the graphics preferences of all users to the recommended diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index d545962e94..3233afc28d 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 72 +version 73  // The version number above should be incremented IF AND ONLY IF some  // change has been made that is sufficiently important to justify  // resetting the graphics preferences of all users to the recommended diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp index 43e8fa3e3c..bf3fada3bd 100644 --- a/indra/newview/gltfscenemanager.cpp +++ b/indra/newview/gltfscenemanager.cpp @@ -69,9 +69,16 @@ void GLTFSceneManager::load()                  {                      return;                  } -                if (filenames.size() > 0) +                try +                { +                    if (filenames.size() > 0) +                    { +                        GLTFSceneManager::instance().load(filenames[0]); +                    } +                } +                catch (std::bad_alloc&)                  { -                    GLTFSceneManager::instance().load(filenames[0]); +                    LLNotificationsUtil::add("CannotOpenFileTooBig");                  }              },              LLFilePicker::FFLOAD_GLTF, diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 829b6380cd..76e308a966 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -504,7 +504,7 @@ void LLAvatarTracker::idleNotifyObservers()  void LLAvatarTracker::notifyObservers()  { -    if (mIsNotifyObservers) +    if (mIsNotifyObservers || (LLStartUp::getStartupState() <= STATE_INVENTORY_CALLBACKS))      {          // Don't allow multiple calls.          // new masks and ids will be processed later from idle. diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 4921964b35..9d212cfe8b 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -253,7 +253,15 @@ void LLDrawable::cleanupReferences()      std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());      mFaces.clear(); -    gPipeline.unlinkDrawable(this); +    if (gPipeline.mInitialized) +    { +        gPipeline.unlinkDrawable(this); +    } +    else if (getSpatialGroup()) +    { +        // Not supposed to happen? +        getSpatialGroup()->getSpatialPartition()->remove(this, getSpatialGroup()); +    }      removeFromOctree(); diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index c05a7fef44..c6fea1ba82 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -101,10 +101,18 @@ namespace Details      void LLEventPollImpl::handleMessage(const LLSD& content)      {          LL_PROFILE_ZONE_SCOPED_CATEGORY_APP; -        std::string msg_name = content["message"]; +        std::string msg_name = content["message"].asString();          LLSD message; -        message["sender"] = mSenderIp; -        message["body"] = content["body"]; +        try +        { +            message["sender"] = mSenderIp; +            message["body"] = content["body"]; +        } +        catch (std::bad_alloc&) +        { +            LLError::LLUserWarningMsg::showOutOfMemory(); +            LL_ERRS("LLCoros") << "Bad memory allocation on message: " << msg_name << LL_ENDL; +        }          LLMessageSystem::dispatch(msg_name, message);      } diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index f08582e860..101ee215cb 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -680,11 +680,15 @@ void LLLocalBitmap::updateGLTFMaterials(LLUUID old_id, LLUUID new_id)              // do not create a new material, reuse existing pointer              // so that mTextureEntires remains untouched              LLGLTFMaterial* render_mat = entry->getGLTFRenderMaterial(); -            if (render_mat) +            if (render_mat && render_mat != mat)              {                  *render_mat = *mat;                  render_mat->applyOverride(*override_mat); // can update mGLTFMaterialWithLocalTextures              } +            else +            { +                LL_WARNS() << "A TE had an override, but no render material" << LL_ENDL; +            }          }      }  } diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 1e3a328464..28160177f6 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2857,9 +2857,16 @@ void LLMaterialEditor::importMaterial()                  {                      return;                  } -                if (filenames.size() > 0) +                try                  { -                    LLMaterialEditor::loadMaterialFromFile(filenames[0], -1); +                    if (filenames.size() > 0) +                    { +                        LLMaterialEditor::loadMaterialFromFile(filenames[0], -1); +                    } +                } +                catch (std::bad_alloc&) +                { +                    LLNotificationsUtil::add("CannotOpenFileTooBig");                  }              },          LLFilePicker::FFLOAD_MATERIAL, diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 6ef202cf28..1876cd3086 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -7490,7 +7490,7 @@ void LLSelectMgr::updatePointAt()              LLVector3 select_offset;              const LLPickInfo& pick = gViewerWindow->getLastPick();              LLViewerObject *click_object = pick.getObject(); -            bool was_hud = pick.mPickHUD && !click_object->isHUDAttachment(); +            bool was_hud = pick.mPickHUD && click_object && !click_object->isHUDAttachment();              if (click_object && click_object->isSelected() && !was_hud)              {                  // clicked on another object in our selection group, use that as target diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 84503e66a5..84854a79d4 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -436,6 +436,14 @@ void LLToast::setVisible(bool show)  void LLToast::updateHoveredState()  { +    if (!mWrapperPanel) +    { +        // Shouldn't be happening. +        // mWrapperPanel should have been inited in the constructor +        // This needs to be figured out and fixed +        llassert(false); +        return; +    }      S32 x, y;      LLUI::getInstance()->getMousePositionScreen(&x, &y); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 263c3dadf6..a2232d21a2 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -547,7 +547,7 @@ public:      U32         renderTransparent(bool first_pass);      void        renderCollisionVolumes();      void        renderBones(const std::string &selected_joint = std::string()); -    void        renderJoints(); +    virtual void renderJoints();      static void deleteCachedImages(bool clearAll=true);      static void destroyGL();      static void restoreGL(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 746ef7cacb..f23af5afa4 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -697,6 +697,7 @@ void LLVOAvatarSelf::idleUpdate(LLAgent &agent, const F64 &time)  // virtual  LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)  { +    std::lock_guard lock(mJointMapMutex);      LLJoint *jointp = NULL;      jointp = LLVOAvatar::getJoint(name);      if (!jointp && mScreenp) @@ -714,6 +715,14 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)      return jointp;  } + +//virtual +void LLVOAvatarSelf::renderJoints() +{ +    std::lock_guard lock(mJointMapMutex); +    LLVOAvatar::renderJoints(); +} +  // virtual  bool LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight)  { diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 051ac791c0..f9bea41b1d 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -92,6 +92,8 @@ public:      /*virtual*/ void        requestStopMotion(LLMotion* motion);      /*virtual*/ LLJoint*    getJoint(const std::string &name); +    /*virtual*/ void renderJoints(); +      /*virtual*/ bool setVisualParamWeight(const LLVisualParam *which_param, F32 weight);      /*virtual*/ bool setVisualParamWeight(const char* param_name, F32 weight);      /*virtual*/ bool setVisualParamWeight(S32 index, F32 weight); @@ -103,6 +105,8 @@ private:      // helper function. Passed in param is assumed to be in avatar's parameter list.      bool setParamWeight(const LLViewerVisualParam *param, F32 weight); +    std::mutex          mJointMapMutex; // getJoint gets used from mesh thread +  /********************************************************************************   **                                                                            **   **                    STATE diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4439e476a2..4245b22e88 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2408,6 +2408,16 @@ Unable to upload snapshot.  File might be too big, try reducing resolution or try again later.    <tag>fail</tag>    </notification> +     +  <notification +   icon="alertmodal.tga" +   name="CannotOpenFileTooBig" +   type="alertmodal"> +Unable to open file. + +Viewer run out of memory while opening file. File might be too big. +  <tag>fail</tag> +  </notification>    <notification     icon="notifytip.tga" | 
