diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 0a9c80911..c483a2b49 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -205,18 +205,29 @@ LLInventoryModel::~LLInventoryModel()
// This is a convenience function to check if one object has a parent
// chain up to the category specified by UUID.
BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id,
- const LLUUID& cat_id)
+ const LLUUID& cat_id,
+ const BOOL break_on_recursion)
{
LLInventoryObject* obj = getObject(obj_id);
+ int depthCounter = 0;
while(obj)
{
const LLUUID& parent_id = obj->getParentUUID();
//
- if(parent_id == obj->getUUID())
+ if(break_on_recursion)
{
- // infinite loop... same thing as having no parent, hopefully.
- llwarns << "This shit has itself as parent! " << parent_id.asString() << ", " << obj->getName() << llendl;
- return FALSE;
+ if(depthCounter++ >= 100)
+ {
+ llwarns << "In way too damn deep, possibly recursive parenting" << llendl;
+ llinfos << obj->getName() << " : " << obj->getUUID() << " : " << parent_id << llendl;
+ return FALSE;
+ }
+ if(parent_id == obj->getUUID())
+ {
+ // infinite loop... same thing as having no parent, hopefully.
+ llwarns << "This shit has itself as parent! " << parent_id.asString() << ", " << obj->getName() << llendl;
+ return FALSE;
+ }
}
//
if( parent_id.isNull() )
@@ -3489,7 +3500,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
// I don't even think changing this did anything
//case LLAssetType::AT_CALLINGCARD:
// // not allowed
- // break;
+ // break;
//
case LLAssetType::AT_OBJECT:
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 59f000dd0..fe02b1d46 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -130,7 +130,7 @@ public:
// This is a convenience function to check if one object has a
// parent chain up to the category specified by UUID.
- BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id);
+ BOOL isObjectDescendentOf(const LLUUID& obj_id, const LLUUID& cat_id, const BOOL break_on_recursion=FALSE);
// Get the object by id. Returns NULL if not found.
// * WARNING: use the pointer returned for read operations - do