summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-07-21 19:12:39 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-07-21 22:42:36 +0300
commit2a75b42f164501e44ea2f35361812f87935c225e (patch)
tree4178b3139fd1e5b6d8ce0200d00b9212813f7b28
parent9fce82688f0b9f972ea49f945505ba102bac639e (diff)
#6014 Speedup cleanupInventory
-rw-r--r--indra/llinventory/llinventory.cpp22
-rw-r--r--indra/newview/llinventorymodel.cpp20
2 files changed, 25 insertions, 17 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index a972967abe..d63709d22f 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -983,12 +983,14 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const
if (mThumbnailUUID.notNull())
{
- sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
+ LLSD& thumbnail = sd[INV_THUMBNAIL_LABEL];
+ thumbnail[INV_ASSET_ID_LABEL] = mThumbnailUUID;
}
if (mFavorite)
{
- sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
+ LLSD& favorite = sd[INV_FAVORITE_LABEL];
+ favorite[INV_TOGGLED_LABEL] = mFavorite;
}
U32 mask = mPermissions.getMaskBase();
@@ -1005,7 +1007,7 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const
cipher.encrypt(shadow_id.mData, UUID_BYTES);
sd[INV_SHADOW_ID_LABEL] = shadow_id;
}
- sd[INV_ASSET_TYPE_LABEL] = std::string(LLAssetType::lookup(mType));
+ sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType);
const std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
if(!inv_type_str.empty())
{
@@ -1298,12 +1300,14 @@ LLSD LLInventoryCategory::asLLSD() const
if (mThumbnailUUID.notNull())
{
- sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
+ LLSD& thumbnail = sd[INV_THUMBNAIL_LABEL];
+ thumbnail[INV_ASSET_ID_LABEL] = mThumbnailUUID;
}
if (mFavorite)
{
- sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
+ LLSD& favorite = sd[INV_FAVORITE_LABEL];
+ favorite[INV_TOGGLED_LABEL] = mFavorite;
}
return sd;
@@ -1563,17 +1567,19 @@ void LLInventoryCategory::exportLLSD(LLSD& cat_data) const
{
cat_data[INV_FOLDER_ID_LABEL] = mUUID;
cat_data[INV_PARENT_ID_LABEL] = mParentUUID;
- cat_data[INV_ASSET_TYPE_LABEL] = std::string(LLAssetType::lookup(mType));
+ cat_data[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType);
cat_data[INV_PREFERRED_TYPE_LABEL] = LLFolderType::lookup(mPreferredType);
cat_data[INV_NAME_LABEL] = mName;
if (mThumbnailUUID.notNull())
{
- cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
+ LLSD& thumbnail = cat_data[INV_THUMBNAIL_LABEL];
+ thumbnail[INV_ASSET_ID_LABEL] = mThumbnailUUID;
}
if (mFavorite)
{
- cat_data[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
+ LLSD& favorite = cat_data[INV_FAVORITE_LABEL];
+ favorite[INV_TOGGLED_LABEL] = mFavorite;
}
}
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index dbcade88c2..7a80c46c73 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -430,29 +430,31 @@ void LLInventoryModel::cleanupInventory()
{
LL_PROFILE_ZONE_SCOPED;
empty();
- // Deleting one observer might erase others from the list, so always pop off the front
- while (!mObservers.empty())
+ // Deleting one observer might trigger removeObserver, so use a local copy
+ if (!mObservers.empty())
{
- observer_list_t::iterator iter = mObservers.begin();
- LLInventoryObserver* observer = *iter;
- mObservers.erase(iter);
- delete observer;
+ observer_list_t observers_to_delete;
+ observers_to_delete.swap(mObservers);
+
+ for (LLInventoryObserver* observer : observers_to_delete)
+ {
+ delete observer;
+ }
}
if (mBulkFecthCallbackSlot.connected())
{
mBulkFecthCallbackSlot.disconnect();
}
- mObservers.clear();
// Run down HTTP transport
mHttpHeaders.reset();
mHttpOptions.reset();
delete mHttpRequestFG;
- mHttpRequestFG = NULL;
+ mHttpRequestFG = nullptr;
delete mHttpRequestBG;
- mHttpRequestBG = NULL;
+ mHttpRequestBG = nullptr;
}
// This is a convenience function to check if one object has a parent