summaryrefslogtreecommitdiff
path: root/indra/newview/llscrollingpanelparam.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-03-23 00:17:29 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-03-24 18:31:32 +0200
commit5ac0b9debc100a5a4d14e9eaad1a6542c927a275 (patch)
tree9652e459fe633de60ad2a9554aebbf2593d21344 /indra/newview/llscrollingpanelparam.cpp
parent3ba9e1c5e564d38c36a6b9e09b0661502f0108e3 (diff)
viewer#951 Crash at LLScrollingPanelParam::draw
I'm not sure what causes this, but 1. Calling expensive getChild inside draw is not a good idea 2. I hope that simplified draw will capture a bit more info in bugsplat or will shift callctack elsewhere
Diffstat (limited to 'indra/newview/llscrollingpanelparam.cpp')
-rw-r--r--indra/newview/llscrollingpanelparam.cpp71
1 files changed, 33 insertions, 38 deletions
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index a77c387573..833eaaf8ca 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -53,44 +53,39 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param
LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints )
: LLScrollingPanelParamBase( panel_params, mesh, param, allow_modify, wearable, jointp, use_hints)
{
- // *HACK To avoid hard coding texture position, lets use border's position for texture.
- LLViewBorder* left_border = getChild<LLViewBorder>("left_border");
-
+ mLessBtn = getChild<LLButton>("less");
+ mMoreBtn = getChild<LLButton>("more");
+ mLeftBorder = getChild<LLViewBorder>("left_border");
+ mRightBorder = getChild<LLViewBorder>("right_border");
+ mMinParamText = getChild<LLUICtrl>("min param text");
+ mMaxParamText = getChild<LLUICtrl>("max param text");
+
+ // *HACK To avoid hard coding texture position, lets use border's position for texture.
static LLUICachedControl<S32> slider_ctrl_height ("UISliderctrlHeight", 0);
- S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth();
- S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth();
+ S32 pos_x = mLeftBorder->getRect().mLeft + mLeftBorder->getBorderWidth();
+ S32 pos_y = mLeftBorder->getRect().mBottom + mLeftBorder->getBorderWidth();
F32 min_weight = param->getMinWeight();
F32 max_weight = param->getMaxWeight();
mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, min_weight, jointp);
- pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth();
+ pos_x = mRightBorder->getRect().mLeft + mLeftBorder->getBorderWidth();
mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight, jointp );
mHintMin->setAllowsUpdates( false );
mHintMax->setAllowsUpdates( false );
- std::string min_name = LLTrans::getString(param->getMinDisplayName());
- std::string max_name = LLTrans::getString(param->getMaxDisplayName());
- getChild<LLUICtrl>("min param text")->setValue(min_name);
- getChild<LLUICtrl>("max param text")->setValue(max_name);
+ mMinParamText->setValue(LLTrans::getString(param->getMinDisplayName()));
+ mMaxParamText->setValue(LLTrans::getString(param->getMaxDisplayName()));
- LLButton* less = getChild<LLButton>("less");
- if (less)
- {
- less->setMouseDownCallback( LLScrollingPanelParam::onHintMinMouseDown, this );
- less->setMouseUpCallback( LLScrollingPanelParam::onHintMinMouseUp, this );
- less->setHeldDownCallback( LLScrollingPanelParam::onHintMinHeldDown, this );
- less->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
- }
+ mLessBtn->setMouseDownCallback(LLScrollingPanelParam::onHintMinMouseDown, this);
+ mLessBtn->setMouseUpCallback(LLScrollingPanelParam::onHintMinMouseUp, this);
+ mLessBtn->setHeldDownCallback(LLScrollingPanelParam::onHintMinHeldDown, this);
+ mLessBtn->setHeldDownDelay(PARAM_STEP_TIME_THRESHOLD);
- LLButton* more = getChild<LLButton>("more");
- if (more)
- {
- more->setMouseDownCallback( LLScrollingPanelParam::onHintMaxMouseDown, this );
- more->setMouseUpCallback( LLScrollingPanelParam::onHintMaxMouseUp, this );
- more->setHeldDownCallback( LLScrollingPanelParam::onHintMaxHeldDown, this );
- more->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
- }
+ mMoreBtn->setMouseDownCallback(LLScrollingPanelParam::onHintMaxMouseDown, this);
+ mMoreBtn->setMouseUpCallback(LLScrollingPanelParam::onHintMaxMouseUp, this);
+ mMoreBtn->setHeldDownCallback(LLScrollingPanelParam::onHintMaxHeldDown, this);
+ mMoreBtn->setHeldDownDelay(PARAM_STEP_TIME_THRESHOLD);
setVisible(false);
setBorderVisible( false );
@@ -110,8 +105,8 @@ void LLScrollingPanelParam::updatePanel(bool allow_modify)
mHintMin->requestUpdate( sUpdateDelayFrames++ );
mHintMax->requestUpdate( sUpdateDelayFrames++ );
- getChildView("less")->setEnabled(mAllowModify);
- getChildView("more")->setEnabled(mAllowModify);
+ mLessBtn->setEnabled(mAllowModify);
+ mMoreBtn->setEnabled(mAllowModify);
}
void LLScrollingPanelParam::setVisible( bool visible )
@@ -141,16 +136,16 @@ void LLScrollingPanelParam::draw()
return;
}
- getChildView("less")->setVisible( mHintMin->getVisible());
- getChildView("more")->setVisible( mHintMax->getVisible());
+ mLessBtn->setVisible( mHintMin->getVisible());
+ mMoreBtn->setVisible( mHintMax->getVisible());
// hide borders if texture has been loaded
- getChildView("left_border")->setVisible( !mHintMin->getVisible());
- getChildView("right_border")->setVisible( !mHintMax->getVisible());
+ mLeftBorder->setVisible( !mHintMin->getVisible());
+ mRightBorder->setVisible( !mHintMax->getVisible());
// Draw all the children except for the labels
- getChildView("min param text")->setVisible( false );
- getChildView("max param text")->setVisible( false );
+ mMinParamText->setVisible( false );
+ mMaxParamText->setVisible( false );
LLPanel::draw();
// If we're in a focused floater, don't apply the floater's alpha to visual param hint,
@@ -176,11 +171,11 @@ void LLScrollingPanelParam::draw()
// Draw labels on top of the buttons
- getChildView("min param text")->setVisible( true );
- drawChild(getChild<LLView>("min param text"));
+ mMinParamText->setVisible( true );
+ drawChild(mMinParamText);
- getChildView("max param text")->setVisible( true );
- drawChild(getChild<LLView>("max param text"));
+ mMaxParamText->setVisible( true );
+ drawChild(mMaxParamText);
}
// static