From 14cbf331cbf345bac83606ee5f56c994694420b3 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Tue, 2 Jul 2024 08:56:42 -0400 Subject: Reduce string temporaries from LLTabContainer, LLMenuGL, LLLayoutStack, and LLKeywords using string_view --- indra/llui/lllayoutstack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/lllayoutstack.cpp') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 6db9f64a97..bb09f7a26e 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -548,7 +548,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const return NULL; } -LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const +LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(std::string_view name) const { LLLayoutPanel* result = NULL; -- cgit v1.2.3 From 9fdca96f8bd2211a99fe88e57b70cbecefa20b6d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 8 Jul 2024 20:27:14 +0200 Subject: Re-enable compiler warnings C4244 and C4396 except for lltracerecording.h and llunittype.h for now --- indra/llui/lllayoutstack.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui/lllayoutstack.cpp') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index bb09f7a26e..7ee31ebd00 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -131,7 +131,7 @@ void LLLayoutPanel::setTargetDim(S32 value) S32 LLLayoutPanel::getVisibleDim() const { - F32 min_dim = getRelevantMinDim(); + F32 min_dim = (F32)getRelevantMinDim(); return ll_round(mVisibleAmt * (min_dim + (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt)))); @@ -445,7 +445,7 @@ void LLLayoutStack::updateLayout() for (LLLayoutPanel* panelp : mPanels) { - F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim); + F32 panel_dim = (F32)llmax(panelp->getExpandedMinDim(), panelp->mTargetDim); LLRect panel_rect; if (mOrientation == HORIZONTAL) @@ -465,7 +465,7 @@ void LLLayoutStack::updateLayout() LLRect resize_bar_rect(panel_rect); F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount(); - F32 panel_visible_dim = panelp->getVisibleDim(); + F32 panel_visible_dim = (F32)panelp->getVisibleDim(); S32 panel_spacing_round = (S32)(ll_round(panel_spacing)); if (mOrientation == HORIZONTAL) -- cgit v1.2.3 From 7ebbc58ae310b5c41efb3fe1460d63663ab92004 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 22 Jul 2024 08:29:35 -0400 Subject: Cache various frequently accessed settings (#2080) --- indra/llui/lllayoutstack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/lllayoutstack.cpp') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 7ee31ebd00..3a3aa7e4df 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -209,7 +209,7 @@ LLLayoutStack::Params::Params() open_time_constant("open_time_constant", 0.02f), close_time_constant("close_time_constant", 0.03f), resize_bar_overlap("resize_bar_overlap", 1), - border_size("border_size", LLCachedControl(*LLUI::getInstance()->mSettingGroups["config"], "UIResizeBarHeight", 0)), + border_size("border_size", LLUI::getInstance()->mSettingGroups["config"]->getS32("UIResizeBarHeight")), show_drag_handle("show_drag_handle", false), drag_handle_first_indent("drag_handle_first_indent", 0), drag_handle_second_indent("drag_handle_second_indent", 0), -- cgit v1.2.3 From ee320b22b39c7ecaecb26a04683c6ccbea0deab6 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 14 Aug 2024 14:04:19 +0200 Subject: #2289 BugSplat Crash #1496385: SecondLifeViewer!LLFocusableElement::~LLFocusableElement(79) --- indra/llui/lllayoutstack.cpp | 51 ++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'indra/llui/lllayoutstack.cpp') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 3a3aa7e4df..1c59938f90 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -86,10 +86,6 @@ void LLLayoutPanel::initFromParams(const Params& p) LLLayoutPanel::~LLLayoutPanel() { - // probably not necessary, but... - delete mResizeBar; - mResizeBar = NULL; - gFocusMgr.removeKeyboardFocusWithoutCallback(this); } @@ -242,11 +238,9 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) LLLayoutStack::~LLLayoutStack() { - e_panel_list_t panels = mPanels; // copy list of panel pointers - mPanels.clear(); // clear so that removeChild() calls don't cause trouble - std::for_each(panels.begin(), panels.end(), DeletePointer()); } +// virtual void LLLayoutStack::draw() { updateLayout(); @@ -284,8 +278,14 @@ void LLLayoutStack::draw() } } +// virtual void LLLayoutStack::deleteAllChildren() { + for (LLLayoutPanel* p : mPanels) + { + p->mResizeBar = nullptr; + } + mPanels.clear(); LLView::deleteAllChildren(); @@ -295,29 +295,47 @@ void LLLayoutStack::deleteAllChildren() mNeedsLayout = true; } +// virtual void LLLayoutStack::removeChild(LLView* view) { - LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast(view)); - - if (embedded_panelp) + if (LLLayoutPanel* embedded_panelp = dynamic_cast(view)) { - mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); - LLView::removeChild(view); - updateFractionalSizes(); - mNeedsLayout = true; + auto it = std::find(mPanels.begin(), mPanels.end(), embedded_panelp); + if (it != mPanels.end()) + { + mPanels.erase(it); + } + if (embedded_panelp->mResizeBar) + { + LLView::removeChild(embedded_panelp->mResizeBar); + embedded_panelp->mResizeBar = nullptr; + } } - else + else if (LLResizeBar* resize_bar = dynamic_cast(view)) { - LLView::removeChild(view); + for (LLLayoutPanel* p : mPanels) + { + if (p->mResizeBar == resize_bar) + { + p->mResizeBar = nullptr; + } + } } + + LLView::removeChild(view); + + updateFractionalSizes(); + mNeedsLayout = true; } +// virtual bool LLLayoutStack::postBuild() { updateLayout(); return true; } +// virtual bool LLLayoutStack::addChild(LLView* child, S32 tab_group) { LLLayoutPanel* panelp = dynamic_cast(child); @@ -983,6 +1001,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& //normalizeFractionalSizes(); } +// virtual void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent) { mNeedsLayout = true; -- cgit v1.2.3