summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-02-02 20:25:48 -0500
committerLoren Shih <seraph@lindenlab.com>2010-02-02 20:25:48 -0500
commit85cc9f121d0b8cb5c10a9ed505a9f67bb9b87862 (patch)
treeb7f62d14a331ac4758dfebc021a2c7e554d9d394 /indra/newview/llinventorymodel.cpp
parentf22fc1e6129a7e56421a0777d69c64265d9ec4af (diff)
EXT-4874 : Client freezes on right click - take item
Fixed infinite loop due to parent_id not being incremented properly in loop.
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index bdf1ebddac..05e366523a 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -317,7 +317,10 @@ BOOL LLInventoryModel::isObjectDescendentOf(const LLUUID& obj_id,
const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(const LLUUID& obj_id) const
{
const LLInventoryObject* obj = getObject(obj_id);
- const LLUUID& parent_id = obj->getParentUUID();
+
+ // Search up the parent chain until we get to root or an acceptable folder.
+ // This assumes there are no cycles in the tree else we'll get a hang.
+ LLUUID parent_id = obj->getParentUUID();
while (!parent_id.isNull())
{
const LLViewerInventoryCategory *cat = getCategory(parent_id);
@@ -329,6 +332,7 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons
{
return cat;
}
+ parent_id = cat->getParentUUID();
}
return NULL;
}