From dadc70a8b7dec67191efbad3459d804e393bf9b8 Mon Sep 17 00:00:00 2001
From: Rye <rye@lindenlab.com>
Date: Tue, 29 Oct 2024 20:23:27 -0700
Subject: Fix small hotspot during particle load

---
 indra/llmessage/llpartdata.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp
index d4cf95c1e3..b626637862 100644
--- a/indra/llmessage/llpartdata.cpp
+++ b/indra/llmessage/llpartdata.cpp
@@ -331,7 +331,7 @@ bool LLPartSysData::isNullPS(const S32 block_num)
 
     S32 size;
     // Check size of block
-    size = gMessageSystem->getSize("ObjectData", block_num, "PSBlock");
+    size = gMessageSystem->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_PSBlock);
 
     if (!size)
     {
@@ -344,7 +344,7 @@ bool LLPartSysData::isNullPS(const S32 block_num)
         return true;
     }
 
-    gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE);
+    gMessageSystem->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_PSBlock, ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE);
 
     LLDataPackerBinaryBuffer dp(ps_data_block, size);
     if (size > PS_LEGACY_DATA_BLOCK_SIZE)
@@ -373,7 +373,7 @@ bool LLPartSysData::unpackBlock(const S32 block_num)
     U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE];
 
     // Check size of block
-    S32 size = gMessageSystem->getSize("ObjectData", block_num, "PSBlock");
+    S32 size = gMessageSystem->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_PSBlock);
 
     if (size > PS_MAX_DATA_BLOCK_SIZE)
     {
@@ -382,7 +382,7 @@ bool LLPartSysData::unpackBlock(const S32 block_num)
     }
 
     // Get from message
-    gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE);
+    gMessageSystem->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_PSBlock, ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE);
 
     LLDataPackerBinaryBuffer dp(ps_data_block, size);
 
-- 
cgit v1.2.3


From 2039009f6c5aac15e85a41bd35ad38763d25ad5f Mon Sep 17 00:00:00 2001
From: Rye <rye@lindenlab.com>
Date: Tue, 29 Oct 2024 20:24:03 -0700
Subject: Fix LLMutexLock usage in LLModelPreview

---
 indra/newview/llmodelpreview.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index 1e7da126b0..ecca593d51 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -3565,7 +3565,7 @@ bool LLModelPreview::render()
                         LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
                         if (decomp)
                         {
-                            LLMutexLock(decomp->mMutex);
+                            LLMutexLock lock(decomp->mMutex);
 
                             LLModel::Decomposition& physics = model->mPhysics;
 
@@ -3686,7 +3686,7 @@ bool LLModelPreview::render()
                             LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
                             if (decomp)
                             {
-                                LLMutexLock(decomp->mMutex);
+                                LLMutexLock lock(decomp->mMutex);
 
                                 LLModel::Decomposition& physics = model->mPhysics;
 
-- 
cgit v1.2.3


From d1a4cbb8fa9058c4d3a8fc3ebe3a543626aac77e Mon Sep 17 00:00:00 2001
From: Rye <rye@lindenlab.com>
Date: Tue, 29 Oct 2024 20:24:40 -0700
Subject: Fixes to LLCachedControl usage in windowing and avatars

---
 indra/newview/llviewerwindow.cpp | 14 ++++++++------
 indra/newview/llvoavatar.cpp     |  4 ++--
 indra/newview/llvoavatar.h       |  2 --
 3 files changed, 10 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cc3e916270..d339d0c37c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -268,9 +268,6 @@ static const F32 MIN_DISPLAY_SCALE = 0.75f;
 
 static const char KEY_MOUSELOOK = 'M';
 
-static LLCachedControl<std::string> sSnapshotBaseName(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot"));
-static LLCachedControl<std::string> sSnapshotDir(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseDir", ""));
-
 LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity");
 
 
@@ -2012,6 +2009,7 @@ LLViewerWindow::LLViewerWindow(const Params& p)
 
 std::string LLViewerWindow::getLastSnapshotDir()
 {
+    static LLCachedControl<std::string> sSnapshotDir(gSavedPerAccountSettings, "SnapshotBaseDir", "");
     return sSnapshotDir;
 }
 
@@ -3782,7 +3780,7 @@ void LLViewerWindow::updateLayout()
 {
     LLToolMgr* tool_mgr = LLToolMgr::getInstance();
     LLTool* tool = tool_mgr->getCurrentTool();
-    LLCachedControl<bool> freeze_time(gSavedSettings, "FreezeTime");
+    static LLCachedControl<bool> freeze_time(gSavedSettings, "FreezeTime");
     if (gFloaterTools != NULL
         && tool != NULL
         && tool != gToolNull
@@ -4711,6 +4709,7 @@ void LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picke
     // Get a base file location if needed.
     if (force_picker || !isSnapshotLocSet())
     {
+        static LLCachedControl<std::string> sSnapshotBaseName(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot");
         std::string proposed_name(sSnapshotBaseName);
 
         // getSaveFile will append an appropriate extension to the proposed name, based on the ESaveFilter constant passed in.
@@ -4756,6 +4755,9 @@ void LLViewerWindow::onSelectionFailure(const snapshot_saved_signal_t::slot_type
 
 void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_saved_signal_t::slot_type& success_cb, const snapshot_saved_signal_t::slot_type& failure_cb)
 {
+    static LLCachedControl<std::string> sSnapshotBaseName(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot");
+    static LLCachedControl<std::string> sSnapshotDir(gSavedPerAccountSettings, "SnapshotBaseDir", "");
+
     std::string lastSnapshotDir = LLViewerWindow::getLastSnapshotDir();
     if (lastSnapshotDir.empty())
     {
@@ -4907,8 +4909,8 @@ void LLViewerWindow::playSnapshotAnimAndSound()
 
 bool LLViewerWindow::isSnapshotLocSet() const
 {
-    std::string snapshot_dir = sSnapshotDir;
-    return !snapshot_dir.empty();
+    static LLCachedControl<std::string> sSnapshotDir(gSavedPerAccountSettings, "SnapshotBaseDir", "");
+    return !sSnapshotDir().empty();
 }
 
 void LLViewerWindow::resetSnapshotLoc() const
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 690cfaa677..bfed8b9d39 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -687,7 +687,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
     mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN),
     mLoadedCallbacksPaused(false),
     mLoadedCallbackTextures(0),
-    mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar", false)),
     mLastRezzedStatus(-1),
     mIsEditingAppearance(false),
     mUseLocalAppearance(false),
@@ -8523,7 +8522,8 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading)
 
 bool LLVOAvatar::isFullyLoaded() const
 {
-    return (mRenderUnloadedAvatar || mFullyLoaded);
+    static LLCachedControl<bool> render_unloaded_avatars(gSavedSettings, "RenderUnloadedAvatar", false);
+    return (render_unloaded_avatars || mFullyLoaded);
 }
 
 bool LLVOAvatar::isTooComplex() const
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index dd1725c322..557ccddf99 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -668,8 +668,6 @@ private:
     LLVector3   mLastAnimExtents[2];
     LLVector3   mLastAnimBasePos;
 
-    LLCachedControl<bool> mRenderUnloadedAvatar;
-
     //--------------------------------------------------------------------
     // Wind rippling in clothes
     //--------------------------------------------------------------------
-- 
cgit v1.2.3


From b44158591b06704de6506d4ec03314e93c800adb Mon Sep 17 00:00:00 2001
From: Rye Cogtail <rye@lindenlab.com>
Date: Wed, 30 Oct 2024 15:29:59 -0400
Subject: Fix potential null pointer deref during image upload

---
 indra/newview/llviewertexturelist.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 752cfb3884..bc9732a9ef 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1422,6 +1422,11 @@ bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image,
         raw_image->getComponents());
 
     LLPointer<LLImageJ2C> compressedImage = LLViewerTextureList::convertToUploadFile(scale_image, max_image_dimentions);
+    if (compressedImage.isNull())
+    {
+        LL_INFOS() << "Couldn't convert to j2c, file : " << out_filename << LL_ENDL;
+        return false;
+    }
     if (compressedImage->getWidth() < min_image_dimentions || compressedImage->getHeight() < min_image_dimentions)
     {
         std::string reason = llformat("Images below %d x %d pixels are not allowed. Actual size: %d x %dpx",
@@ -1432,12 +1437,6 @@ bool LLViewerTextureList::createUploadFile(LLPointer<LLImageRaw> raw_image,
         compressedImage->setLastError(reason);
         return false;
     }
-    if (compressedImage.isNull())
-    {
-        compressedImage->setLastError("Couldn't convert the image to jpeg2000.");
-        LL_INFOS() << "Couldn't convert to j2c, file : " << out_filename << LL_ENDL;
-        return false;
-    }
     if (!compressedImage->save(out_filename))
     {
         compressedImage->setLastError("Couldn't create the jpeg2000 image for upload.");
-- 
cgit v1.2.3


From ae5e4c30468f0712c0f8b28b7b36ada41c198c14 Mon Sep 17 00:00:00 2001
From: Rye Cogtail <rye@lindenlab.com>
Date: Wed, 30 Oct 2024 16:03:53 -0400
Subject: Fix various member variables being access before initialization

---
 indra/llui/llfloater.cpp              | 2 ++
 indra/newview/llinventorygallery.cpp  | 1 +
 indra/newview/lllocationinputctrl.h   | 2 +-
 indra/newview/llmediactrl.cpp         | 4 ----
 indra/newview/llmediactrl.h           | 1 -
 indra/newview/llnetmap.cpp            | 1 +
 indra/newview/llscrollingpanelparam.h | 1 -
 indra/newview/llvoavatar.h            | 4 ++--
 8 files changed, 7 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index fd07b2ec5d..92059f0753 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -247,6 +247,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
     mTitle(p.title),
     mShortTitle(p.short_title),
     mSingleInstance(p.single_instance),
+    mIsReuseInitialized(p.reuse_instance.isProvided()),
     mReuseInstance(p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance), // reuse single-instance floaters by default
     mKey(key),
     mCanTearOff(p.can_tear_off),
@@ -3350,6 +3351,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
     mHeaderHeight = p.header_height;
     mLegacyHeaderHeight = p.legacy_header_height;
     mSingleInstance = p.single_instance;
+    mIsReuseInitialized = p.reuse_instance.isProvided();
     mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance;
 
     mDefaultRelativeX = p.rel_x;
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 03bafa48bd..c7f2b0cb72 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -2777,6 +2777,7 @@ static LLDefaultChildRegistry::Register<LLInventoryGalleryItem> r("inventory_gal
 LLInventoryGalleryItem::LLInventoryGalleryItem(const Params& p)
     : LLPanel(p),
     mSelected(false),
+    mWorn(false),
     mDefaultImage(true),
     mItemName(""),
     mWornSuffix(""),
diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h
index 56e5555ba5..c048b028f5 100644
--- a/indra/newview/lllocationinputctrl.h
+++ b/indra/newview/lllocationinputctrl.h
@@ -206,7 +206,7 @@ private:
     std::string mEditLandmarkTooltip;
     // this field holds a human-readable form of the location string, it is needed to be able to compare copy-pated value and real location
     std::string mHumanReadableLocation;
-    bool isHumanReadableLocationVisible;
+    bool isHumanReadableLocationVisible = true;
     std::string mMaturityHelpTopic;
 };
 
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 49260d5c50..ef9e8d7dac 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -1022,10 +1022,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
         case MEDIA_EVENT_NAVIGATE_COMPLETE:
         {
             LL_DEBUGS("Media") <<  "Media event:  MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL;
-            if(mHidingInitialLoad)
-            {
-                mHidingInitialLoad = false;
-            }
         };
         break;
 
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 9f9564af46..5d3d8f3ba2 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -201,7 +201,6 @@ public:
                 mStretchToFill,
                 mMaintainAspectRatio,
                 mHideLoading,
-                mHidingInitialLoad,
                 mClearCache,
                 mHoverTextChanged,
                 mDecoupleTextureSize,
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 483ddcdd63..bf9aa66094 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -96,6 +96,7 @@ LLNetMap::LLNetMap (const Params & p)
     mPopupWorldPos(0.f, 0.f, 0.f),
     mMouseDown(0, 0),
     mPanning(false),
+    mCentering(false),
     mUpdateNow(false),
     mObjectImageCenterGlobal( gAgentCamera.getCameraPositionGlobal() ),
     mObjectRawImagep(),
diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h
index 3aba4e4e40..93daf22e76 100644
--- a/indra/newview/llscrollingpanelparam.h
+++ b/indra/newview/llscrollingpanelparam.h
@@ -81,7 +81,6 @@ public:
 protected:
     LLTimer             mMouseDownTimer;    // timer for how long mouse has been held down on a hint.
     F32                 mLastHeldTime;
-    bool mAllowModify;
 
     LLButton* mLessBtn;
     LLButton* mMoreBtn;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 557ccddf99..a9dea1f1e3 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -1012,7 +1012,7 @@ public:
     void            startTyping() { mTyping = true; mTypingTimer.reset(); }
     void            stopTyping() { mTyping = false; }
 private:
-    bool            mVisibleChat;
+    bool            mVisibleChat = false;
 
     //--------------------------------------------------------------------
     // Lip synch morphs
@@ -1194,7 +1194,7 @@ public:
     static F32          sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
 protected:
     S32                 getUnbakedPixelAreaRank();
-    bool                mHasGrey;
+    bool                mHasGrey = false;
 private:
     F32                 mMinPixelArea;
     F32                 mMaxPixelArea;
-- 
cgit v1.2.3


From 067d568721ab65e5c806385a8c98d7a843ddf907 Mon Sep 17 00:00:00 2001
From: Rye Cogtail <rye@lindenlab.com>
Date: Wed, 30 Oct 2024 16:05:36 -0400
Subject: Fix potential crash from LLWorld being called before singleton
 creation during early init

---
 indra/newview/llviewershadermgr.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index a6d397c039..c219b0575e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -985,7 +985,10 @@ bool LLViewerShaderMgr::loadShadersWater()
         return loadShadersWater();
     }
 
-    LLWorld::getInstance()->updateWaterObjects();
+    if (LLWorld::instanceExists())
+    {
+        LLWorld::getInstance()->updateWaterObjects();
+    }
 
     return true;
 }
-- 
cgit v1.2.3


From 914a955ea2c32e574af64d01d8c8be8ce9d23504 Mon Sep 17 00:00:00 2001
From: Rye Cogtail <rye@lindenlab.com>
Date: Wed, 30 Oct 2024 16:06:32 -0400
Subject: Fix potential shift by -1 exponent in flexi object update

---
 indra/newview/llflexibleobject.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index 7d098b2676..8897ad55e0 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -151,7 +151,6 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
 {
     S32 num_output_sections = 1<<dest_sections;
     LLVector3 scale = mVO->mDrawable->getScale();
-    F32 source_section_length = scale.mV[VZ] / (F32)(1<<source_sections);
     F32 section_length = scale.mV[VZ] / (F32)num_output_sections;
     if (source_sections == -1)
     {
@@ -183,6 +182,7 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
         // Iterate from right to left since it may be an in-place computation
         S32 step_shift = dest_sections-source_sections;
         S32 num_steps = 1<<step_shift;
+        F32 source_section_length = scale.mV[VZ] / (F32)(1<<source_sections);
         for (S32 section=num_output_sections-num_steps; section>=0; section -= num_steps)
         {
             LLFlexibleObjectSection *last_source_section = &source[section>>step_shift];
-- 
cgit v1.2.3


From 20fc24d66564674c74b5d4ac30887af10cf9a8cd Mon Sep 17 00:00:00 2001
From: Rye Cogtail <rye@lindenlab.com>
Date: Wed, 30 Oct 2024 17:19:01 -0400
Subject: Fix uninitialized glm::mat4 in LLGL

---
 indra/llrender/llgl.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 9209cdcb51..7bc9124ac1 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -2750,7 +2750,7 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
     if(cplane[2] < 0)
         cplane *= -1;
 
-    glm::mat4 suffix;
+    glm::mat4 suffix = glm::identity<glm::mat4>();
     suffix = glm::row(suffix, 2, cplane);
     glm::mat4 newP = suffix * P;
     gGL.matrixMode(LLRender::MM_PROJECTION);
-- 
cgit v1.2.3