summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-05-15 09:15:57 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-05-15 09:15:57 -0400
commit6fcc9a0eae892a8bfc1079e100a37da7f781330b (patch)
treed8c5cb3ab9aaf52cf4ffa2bed92ff66d465fa2b4 /indra/newview/llinventorymodel.cpp
parentc3da5bb12d1c7c173929433589a4068555791bea (diff)
parentbb3c36f5cbc0c3b542045fd27255eee24e03da22 (diff)
Merge branch 'main' into release/luau-scripting for Maint X release.
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 6408d4eaf6..5325c28abf 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1744,12 +1744,10 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item,
<< " from " << make_inventory_info(item->getParentUUID())
<< " to " << make_inventory_info(new_parent_id) << LL_ENDL;
- LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- accountForUpdate(update);
+ accountForUpdate(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1, false);
+ accountForUpdate(new_folder);
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setParent(new_parent_id);
@@ -1779,12 +1777,10 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat,
<< " from " << make_inventory_info(cat->getParentUUID())
<< " to " << make_inventory_info(new_parent_id) << LL_ENDL;
- LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
- update.push_back(new_folder);
- accountForUpdate(update);
+ accountForUpdate(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1, false);
+ accountForUpdate(new_folder);
LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
new_cat->setParent(new_parent_id);
@@ -2542,7 +2538,10 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
{
descendents_actual += update.mDescendentDelta;
cat->setDescendentCount(descendents_actual);
+ if (update.mChangeVersion)
+ {
cat->setVersion(++version);
+ }
LL_DEBUGS(LOG_INV) << "accounted: '" << cat->getName() << "' "
<< version << " with " << descendents_actual
<< " descendents." << LL_ENDL;
@@ -2570,7 +2569,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
}
void LLInventoryModel::accountForUpdate(
- const LLInventoryModel::update_list_t& update)
+ const LLInventoryModel::update_list_t& update) const
{
update_list_t::const_iterator it = update.begin();
update_list_t::const_iterator end = update.end();
@@ -2581,7 +2580,7 @@ void LLInventoryModel::accountForUpdate(
}
void LLInventoryModel::accountForUpdate(
- const LLInventoryModel::update_map_t& update)
+ const LLInventoryModel::update_map_t& update) const
{
LLCategoryUpdate up;
update_map_t::const_iterator it = update.begin();
@@ -2706,6 +2705,17 @@ bool LLInventoryModel::loadSkeleton(
gzip_filename.append(".gz");
LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
bool remove_inventory_file = false;
+ if (LLAppViewer::instance()->isSecondInstance())
+ {
+ // Safeguard viewer against trying to unpack file twice
+ // ex: user logs into two accounts simultaneously, so two
+ // viewers are trying to unpack library into same file
+ //
+ // Would be better to do it in gunzip_file, but it doesn't
+ // have access to llfilesystem
+ inventory_filename = gDirUtilp->getTempFilename();
+ remove_inventory_file = true;
+ }
if(fp)
{
fclose(fp);
@@ -2914,7 +2924,7 @@ bool LLInventoryModel::loadSkeleton(
// clean up the gunzipped file.
LLFile::remove(inventory_filename);
}
- if(is_cache_obsolete)
+ if(is_cache_obsolete && !LLAppViewer::instance()->isSecondInstance())
{
// If out of date, remove the gzipped file too.
LL_WARNS(LOG_INV) << "Inv cache out of date, removing" << LL_ENDL;