summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-06 22:42:49 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-06 22:42:49 +0300
commitb2ad2f064504688e31a67366a9d64cea8a9822fe (patch)
treef706ec562514a86bb1691786d34f1cf893d526fd /indra
parentfc73378865343c695e85cc36512e3b4568081416 (diff)
SL-18297 A freeze while checking marketplace for errors
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventoryfunctions.cpp31
-rw-r--r--indra/newview/llinventoryfunctions.h2
-rw-r--r--indra/newview/llinventorymodel.cpp11
3 files changed, 32 insertions, 12 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index fb73d391ec..5755bc692e 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -862,6 +862,9 @@ LLUUID create_folder_for_item(LLInventoryItem* item, const LLUUID& destFolderId)
S32 depth_nesting_in_marketplace(LLUUID cur_uuid)
{
// Get the marketplace listings root, exit with -1 (i.e. not under the marketplace listings root) if none
+ // Todo: findCategoryUUIDForType is somewhat expensive with large
+ // flat root folders yet we use depth_nesting_in_marketplace at
+ // every turn, find a way to correctly cache this id.
const LLUUID marketplace_listings_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
if (marketplace_listings_uuid.isNull())
{
@@ -1504,7 +1507,12 @@ void dump_trace(std::string& message, S32 depth, LLError::ELevel log_level)
// This function does no deletion of listings but a mere audit and raises issues to the user (through the
// optional callback cb). It also returns a boolean, true if things validate, false if issues are raised.
// The only inventory changes that are done is to move and sort folders containing no-copy items to stock folders.
-bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_t cb, bool fix_hierarchy, S32 depth)
+bool validate_marketplacelistings(
+ LLInventoryCategory* cat,
+ validation_callback_t cb,
+ bool fix_hierarchy,
+ S32 depth,
+ bool notify_observers)
{
#if 0
// Used only for debug
@@ -1570,7 +1578,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
LLUUID folder_uuid = gInventory.createNewCategory(parent_uuid, LLFolderType::FT_NONE, cat->getName());
LLInventoryCategory* new_cat = gInventory.getCategory(folder_uuid);
gInventory.changeCategoryParent(viewer_cat, folder_uuid, false);
- result &= validate_marketplacelistings(new_cat, cb, fix_hierarchy, depth + 1);
+ result &= validate_marketplacelistings(new_cat, cb, fix_hierarchy, depth + 1, notify_observers);
return result;
}
else
@@ -1740,7 +1748,10 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
// Next type
update_marketplace_category(parent_uuid);
update_marketplace_category(folder_uuid);
- gInventory.notifyObservers();
+ if (notify_observers)
+ {
+ gInventory.notifyObservers();
+ }
items_vector_it++;
}
}
@@ -1754,7 +1765,7 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
{
LLViewerInventoryCategory * viewer_cat = (LLViewerInventoryCategory *) (*iter);
gInventory.changeCategoryParent(viewer_cat, parent_uuid, false);
- result &= validate_marketplacelistings(viewer_cat, cb, fix_hierarchy, depth);
+ result &= validate_marketplacelistings(viewer_cat, cb, fix_hierarchy, depth, false);
}
}
}
@@ -1826,7 +1837,10 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
cb(message,depth,LLError::LEVEL_WARN);
}
gInventory.removeCategory(cat->getUUID());
- gInventory.notifyObservers();
+ if (notify_observers)
+ {
+ gInventory.notifyObservers();
+ }
return result && !has_bad_items;
}
}
@@ -1840,11 +1854,14 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
{
LLInventoryCategory* category = *iter;
- result &= validate_marketplacelistings(category, cb, fix_hierarchy, depth + 1);
+ result &= validate_marketplacelistings(category, cb, fix_hierarchy, depth + 1, false);
}
update_marketplace_category(cat->getUUID(), true, true);
- gInventory.notifyObservers();
+ if (notify_observers)
+ {
+ gInventory.notifyObservers();
+ }
return result && !has_bad_items;
}
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index ba9f157e47..56ad6f6496 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -87,7 +87,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size = 1, bool check_items = true, bool from_paste = false);
bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false);
bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false, bool move_no_copy_items = false);
-bool validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL, bool fix_hierarchy = true, S32 depth = -1);
+bool validate_marketplacelistings(LLInventoryCategory* inv_cat, validation_callback_t cb = NULL, bool fix_hierarchy = true, S32 depth = -1, bool notify_observers = true);
S32 depth_nesting_in_marketplace(LLUUID cur_uuid);
LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth);
S32 compute_stock_count(LLUUID cat_uuid, bool force_count = false);
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index b1ecf8e928..1b794d7525 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1851,10 +1851,13 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
mChangedItemIDs.insert(referent);
}
- // Fix me: From DD-81, probably shouldn't be here, instead
- // should be somewhere in an observer or in
- // LLMarketplaceInventoryObserver::onIdleProcessQueue
- update_marketplace_category(referent, false);
+ if (mask != LLInventoryObserver::LABEL)
+ {
+ // Fix me: From DD-81, probably shouldn't be here, instead
+ // should be somewhere in an observer or in
+ // LLMarketplaceInventoryObserver::onIdleProcessQueue
+ update_marketplace_category(referent, false);
+ }
if (mask & LLInventoryObserver::ADD)
{