summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-10-20 20:24:23 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-10-20 20:24:23 +0300
commit701edc36f3ed03c89a563fc25fc661c90fbd0c94 (patch)
tree97af66f267615b6650d2230afee95937afd700ad
parent89fb672503d9dee4f18b11460f66d6c74ec190fd (diff)
SL-14138 Favorites panel was not responding in some cases
-rw-r--r--indra/newview/llfavoritesbar.cpp58
-rw-r--r--indra/newview/llfavoritesbar.h2
2 files changed, 35 insertions, 25 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 347997a69a..c76920c9ce 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -677,8 +677,12 @@ void LLFavoritesBarCtrl::changed(U32 mask)
//virtual
void LLFavoritesBarCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
{
+ S32 delta_width = width - getRect().getWidth();
+ S32 delta_height = height - getRect().getHeight();
+
+ bool force_update = delta_width || delta_height || sForceReshape;
LLUICtrl::reshape(width, height, called_from_parent);
- updateButtons();
+ updateButtons(force_update);
}
void LLFavoritesBarCtrl::draw()
@@ -741,8 +745,13 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams()
return button_params;
}
-void LLFavoritesBarCtrl::updateButtons()
+void LLFavoritesBarCtrl::updateButtons(bool force_update)
{
+ if (LLApp::isExiting())
+ {
+ return;
+ }
+
mItems.clear();
if (!collectFavoriteItems(mItems))
@@ -773,28 +782,29 @@ void LLFavoritesBarCtrl::updateButtons()
const child_list_t* childs = getChildList();
child_list_const_iter_t child_it = childs->begin();
int first_changed_item_index = 0;
- int rightest_point = getRect().mRight - mMoreTextBox->getRect().getWidth();
- //lets find first changed button
- while (child_it != childs->end() && first_changed_item_index < mItems.size())
- {
- LLFavoriteLandmarkButton* button = dynamic_cast<LLFavoriteLandmarkButton*> (*child_it);
- if (button)
- {
- const LLViewerInventoryItem *item = mItems[first_changed_item_index].get();
- if (item)
- {
- // an child's order and mItems should be same
- if (button->getLandmarkId() != item->getUUID() // sort order has been changed
- || button->getLabelSelected() != item->getName() // favorite's name has been changed
- || button->getRect().mRight < rightest_point) // favbar's width has been changed
- {
- break;
- }
- }
- first_changed_item_index++;
- }
- child_it++;
- }
+ if (!force_update)
+ {
+ //lets find first changed button
+ while (child_it != childs->end() && first_changed_item_index < mItems.size())
+ {
+ LLFavoriteLandmarkButton* button = dynamic_cast<LLFavoriteLandmarkButton*> (*child_it);
+ if (button)
+ {
+ const LLViewerInventoryItem *item = mItems[first_changed_item_index].get();
+ if (item)
+ {
+ // an child's order and mItems should be same
+ if (button->getLandmarkId() != item->getUUID() // sort order has been changed
+ || button->getLabelSelected() != item->getName()) // favorite's name has been changed
+ {
+ break;
+ }
+ }
+ first_changed_item_index++;
+ }
+ child_it++;
+ }
+ }
// now first_changed_item_index should contains a number of button that need to change
if (first_changed_item_index <= mItems.size())
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index 571208aa31..d4a6f7b06b 100644
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -75,7 +75,7 @@ public:
void setLandingTab(LLUICtrl* tab) { mLandingTab = tab; }
protected:
- void updateButtons();
+ void updateButtons(bool force_update = false);
LLButton* createButton(const LLPointer<LLViewerInventoryItem> item, const LLButton::Params& button_params, S32 x_offset );
const LLButton::Params& getButtonParams();
BOOL collectFavoriteItems(LLInventoryModel::item_array_t &items);