From 145aa1d0740e74aa98f7809dd1f2668b0546a131 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 18 Feb 2016 11:36:05 +0200 Subject: MAINT-6119 Viewer needs a few NULL uuid checks --- indra/newview/llinventorymodel.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index e123a3e68a..1ae8fc418f 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3418,6 +3418,11 @@ void LLInventoryModel::removeCategory(const LLUUID& category_id) void LLInventoryModel::removeObject(const LLUUID& object_id) { + if(object_id.isNull()) + { + return; + } + LLInventoryObject* obj = getObject(object_id); if (dynamic_cast(obj)) { -- cgit v1.2.3 From ac6af25508eaa3339ddd294dfe3bc55c3435b796 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 31 Mar 2016 18:08:31 +0300 Subject: MAINT-6238 Warn user if Trash is overflowing --- indra/newview/llinventorymodel.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 1ae8fc418f..1554940a25 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -771,6 +771,22 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, } } +U32 LLInventoryModel::getDescendentsCountRecursive(const LLUUID& id, U32 max_item_limit) +{ + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + gInventory.collectDescendents(id, cats, items, LLInventoryModel::INCLUDE_TRASH); + + U32 items_found = items.size() + cats.size(); + + for (U32 i = 0; i < cats.size() && items_found <= max_item_limit; ++i) + { + items_found += getDescendentsCountRecursive(cats[i]->getUUID(), max_item_limit - items_found); + } + + return items_found; +} + void LLInventoryModel::addChangedMaskForLinks(const LLUUID& object_id, U32 mask) { const LLInventoryObject *obj = getObject(object_id); @@ -3333,6 +3349,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) //---------------------------------------------------------------------------- // Trash: LLFolderType::FT_TRASH, "ConfirmEmptyTrash" +// Trash: LLFolderType::FT_TRASH, "TrashIsFull" when trash exceeds maximum capacity // Lost&Found: LLFolderType::FT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound" bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type) @@ -3414,6 +3431,8 @@ void LLInventoryModel::removeCategory(const LLUUID& category_id) changeCategoryParent(cat, trash_id, TRUE); } } + + checkTrashOverflow(); } void LLInventoryModel::removeObject(const LLUUID& object_id) @@ -3444,6 +3463,16 @@ void LLInventoryModel::removeObject(const LLUUID& object_id) } } +void LLInventoryModel::checkTrashOverflow() +{ + static const U32 trash_max_capacity = gSavedSettings.getU32("InventoryTrashMaxCapacity"); + const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); + if (getDescendentsCountRecursive(trash_id, trash_max_capacity) >= trash_max_capacity) + { + gInventory.emptyFolderType("TrashIsFull", LLFolderType::FT_TRASH); + } +} + const LLUUID &LLInventoryModel::getRootFolderID() const { return mRootFolderID; -- cgit v1.2.3 From 352403b0e28ff545099fe234a02f507388477704 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 1 Apr 2016 21:16:07 +0300 Subject: MAINT-6272 Viewer inventory cache bug --- indra/newview/llinventorymodel.cpp | 39 +++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'indra/newview/llinventorymodel.cpp') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 908f7125df..cada2d7cf2 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -44,6 +44,7 @@ #include "llmarketplacefunctions.h" #include "llwindow.h" #include "llviewercontrol.h" +#include "llviewernetwork.h" #include "llpreview.h" #include "llviewermessage.h" #include "llviewerfoldertype.h" @@ -73,7 +74,8 @@ BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; ///---------------------------------------------------------------------------- //BOOL decompress_file(const char* src_filename, const char* dst_filename); -static const char CACHE_FORMAT_STRING[] = "%s.inv"; +static const char PRODUCTION_CACHE_FORMAT_STRING[] = "%s.inv"; +static const char GRID_CACHE_FORMAT_STRING[] = "%s.%s.inv"; static const char * const LOG_INV("Inventory"); struct InventoryIDPtrLess @@ -1623,6 +1625,29 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const return cat->fetch(); } +//static +std::string LLInventoryModel::getInvCacheAddres(const LLUUID& owner_id) +{ + std::string inventory_addr; + std::string owner_id_str; + owner_id.toString(owner_id_str); + std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); + if (LLGridManager::getInstance()->isInProductionGrid()) + { + inventory_addr = llformat(PRODUCTION_CACHE_FORMAT_STRING, path.c_str()); + } + else + { + // NOTE: The inventory cache filenames now include the grid name. + // Add controls against directory traversal or problematic pathname lengths + // if your viewer uses grid names from an untrusted source. + const std::string& grid_id_str = LLGridManager::getInstance()->getGridId(); + const std::string& grid_id_lower = utf8str_tolower(grid_id_str); + inventory_addr = llformat(GRID_CACHE_FORMAT_STRING, path.c_str(), grid_id_lower.c_str()); + } + return inventory_addr; +} + void LLInventoryModel::cache( const LLUUID& parent_folder_id, const LLUUID& agent_id) @@ -1643,11 +1668,7 @@ void LLInventoryModel::cache( items, INCLUDE_TRASH, can_cache); - std::string agent_id_str; - std::string inventory_filename; - agent_id.toString(agent_id_str); - std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, agent_id_str)); - inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); + std::string inventory_filename = getInvCacheAddres(agent_id); saveToFile(inventory_filename, categories, items); std::string gzip_filename(inventory_filename); gzip_filename.append(".gz"); @@ -1951,11 +1972,7 @@ bool LLInventoryModel::loadSkeleton( item_array_t items; item_array_t possible_broken_links; cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded. - std::string owner_id_str; - owner_id.toString(owner_id_str); - std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); - std::string inventory_filename; - inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); + std::string inventory_filename = getInvCacheAddres(owner_id); const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; std::string gzip_filename(inventory_filename); gzip_filename.append(".gz"); -- cgit v1.2.3