summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp63
1 files changed, 33 insertions, 30 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index e56a0ba414..46e76bc3f8 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1635,6 +1635,9 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo
LL_WARNS(LOG_INV) << "Deleting non-existent object [ id: " << id << " ] " << LL_ENDL;
return;
}
+
+ //collect the links before removing the item from mItemMap
+ LLInventoryModel::item_array_t links = collectLinksTo(id);
LL_DEBUGS(LOG_INV) << "Deleting inventory object " << id << LL_ENDL;
mLastItem = NULL;
@@ -1690,37 +1693,36 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo
// Can't have links to links, so there's no need for this update
// if the item removed is a link. Can also skip if source of the
// update is getting broken link info separately.
- obj = NULL; // delete obj
if (fix_broken_links && !is_link_type)
{
- updateLinkedObjectsFromPurge(id);
+ rebuildLinkItems(links);
}
+ obj = nullptr; // delete obj
if (do_notify_observers)
{
notifyObservers();
}
}
-void LLInventoryModel::updateLinkedObjectsFromPurge(const LLUUID &baseobj_id)
+void LLInventoryModel::rebuildLinkItems(LLInventoryModel::item_array_t& items)
{
- LLInventoryModel::item_array_t item_array = collectLinksTo(baseobj_id);
-
- // REBUILD is expensive, so clear the current change list first else
- // everything else on the changelist will also get rebuilt.
- if (item_array.size() > 0)
- {
- notifyObservers();
- for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
- iter != item_array.end();
- iter++)
- {
- const LLViewerInventoryItem *linked_item = (*iter);
- const LLUUID &item_id = linked_item->getUUID();
- if (item_id == baseobj_id) continue;
- addChangedMask(LLInventoryObserver::REBUILD, item_id);
- }
- notifyObservers();
- }
+ // REBUILD is expensive, so clear the current change list first else
+ // everything else on the changelist will also get rebuilt.
+ if (items.size() > 0)
+ {
+ notifyObservers();
+ for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
+ iter != items.end();
+ iter++)
+ {
+ const LLViewerInventoryItem *linked_item = (*iter);
+ if (linked_item)
+ {
+ addChangedMask(LLInventoryObserver::REBUILD, linked_item->getUUID());
+ }
+ }
+ notifyObservers();
+ }
}
// Add/remove an observer. If the observer is destroyed, be sure to
@@ -1950,18 +1952,20 @@ void LLInventoryModel::cache(
items,
INCLUDE_TRASH,
can_cache);
- std::string inventory_filename = getInvCacheAddres(agent_id);
- saveToFile(inventory_filename, categories, items);
- std::string gzip_filename(inventory_filename);
+ // Use temporary file to avoid potential conflicts with other
+ // instances (even a 'read only' instance unzips into a file)
+ std::string temp_file = gDirUtilp->getTempFilename();
+ saveToFile(temp_file, categories, items);
+ std::string gzip_filename = getInvCacheAddres(agent_id);
gzip_filename.append(".gz");
- if(gzip_file(inventory_filename, gzip_filename))
+ if(gzip_file(temp_file, gzip_filename))
{
- LL_DEBUGS(LOG_INV) << "Successfully compressed " << inventory_filename << LL_ENDL;
- LLFile::remove(inventory_filename);
+ LL_DEBUGS(LOG_INV) << "Successfully compressed " << temp_file << " to " << gzip_filename << LL_ENDL;
+ LLFile::remove(temp_file);
}
else
{
- LL_WARNS(LOG_INV) << "Unable to compress " << inventory_filename << LL_ENDL;
+ LL_WARNS(LOG_INV) << "Unable to compress " << temp_file << " into " << gzip_filename << LL_ENDL;
}
}
@@ -2714,7 +2718,6 @@ void LLInventoryModel::buildParentChildMap()
// some accounts has pbroken inventory root folders
std::string name = "My Inventory";
- LLUUID prev_root_id = mRootFolderID;
for (parent_cat_map_t::const_iterator it = mParentChildCategoryTree.begin(),
it_end = mParentChildCategoryTree.end(); it != it_end; ++it)
{
@@ -3035,6 +3038,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
return false;
}
}
+ fileXML.flush();
fileXML.close();
@@ -4590,7 +4594,6 @@ void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore:
{
gInventory.updateItem(*it);
}
-
gInventory.notifyObservers();
gViewerWindow->getWindow()->decBusyCount();
}