From 1aebbd397ba33442fe5dd856d507c8e851d6f9b7 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 7 Dec 2023 16:53:21 +0100 Subject: SL-20682 renaming of folders seems to fail (but doesn't really) --- indra/newview/llinventorymodel.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8583cca103..ad6d960b8c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1740,12 +1740,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); + LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(), -1); + accountForUpdate(old_folder); + LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1, false); + accountForUpdate(new_folder); LLPointer new_item = new LLViewerInventoryItem(item); new_item->setParent(new_parent_id); @@ -1775,12 +1773,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 new_cat = new LLViewerInventoryCategory(cat); new_cat->setParent(new_parent_id); @@ -2538,7 +2534,10 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const { descendents_actual += update.mDescendentDelta; cat->setDescendentCount(descendents_actual); - cat->setVersion(++version); + if (update.mChangeVersion) + { + cat->setVersion(++version); + } LL_DEBUGS(LOG_INV) << "accounted: '" << cat->getName() << "' " << version << " with " << descendents_actual << " descendents." << LL_ENDL; @@ -2566,7 +2565,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(); @@ -2577,7 +2576,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(); -- cgit v1.2.3 From 50a70fe2f831c6d34a6f518ae040e52ac2f9f924 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 28 Mar 2024 00:45:38 +0200 Subject: viewer#1073 crash at loadSkeleton looks like file that was being parced got corrupted 'in progress' --- indra/newview/llinventorymodel.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index eebc79c1c6..10feb16346 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -2705,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); @@ -2913,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; -- cgit v1.2.3