diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-05-15 13:27:16 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-05-15 13:27:16 -0400 |
commit | 2ed3746aee81901435f3f28f71a497d234d680d2 (patch) | |
tree | e524b1fb98d461ded1bd5ee6a967f8eb00ad26df | |
parent | 931410211e1d644028f5b09cbf77b179e0e75aab (diff) |
SH-4197 FIX - also simplified the category remove flow for AIS, don't need to purge descendents first.
-rwxr-xr-x | indra/newview/llviewerinventory.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index e819479923..202ed43caa 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1155,8 +1155,6 @@ public: return; } gInventory.onAISUpdateReceived("removeObjectResponder " + mItemUUID.asString(), content); - // FIXME - not needed after AIS starts returning deleted item in its response. - gInventory.onObjectDeletedFromServer(mItemUUID); if (mCallback) { @@ -1226,18 +1224,26 @@ void remove_inventory_item( } } -class LLRemoveObjectOnDestroy: public LLInventoryCallback +class LLRemoveCategoryOnDestroy: public LLInventoryCallback { public: - LLRemoveObjectOnDestroy(const LLUUID& item_id, LLPointer<LLInventoryCallback> cb): - mID(item_id), + LLRemoveCategoryOnDestroy(const LLUUID& cat_id, LLPointer<LLInventoryCallback> cb): + mID(cat_id), mCB(cb) { } /* virtual */ void fire(const LLUUID& item_id) {} - ~LLRemoveObjectOnDestroy() + ~LLRemoveCategoryOnDestroy() { - remove_inventory_object(mID, mCB); + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID); + if(children != LLInventoryModel::CHILDREN_NO) + { + llwarns << "remove descendents failed, cannot remove category " << llendl; + } + else + { + remove_inventory_category(mID, mCB); + } } private: LLUUID mID; @@ -1257,15 +1263,6 @@ void remove_inventory_category( LLNotificationsUtil::add("CannotRemoveProtectedCategories"); return; } - LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); - if(children != LLInventoryModel::CHILDREN_NO) - { - llinfos << "Will purge descendents first before deleting category " << cat_id << llendl; - LLPointer<LLInventoryCallback> wrap_cb = new LLRemoveObjectOnDestroy(cat_id,cb); - purge_descendents_of(cat_id, wrap_cb); - return; - } - std::string cap; if (gAgent.getRegion()) { @@ -1280,6 +1277,16 @@ void remove_inventory_category( } else // no cap { + // RemoveInventoryFolder does not remove children, so must + // clear descendents first. + LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(cat_id); + if(children != LLInventoryModel::CHILDREN_NO) + { + llinfos << "Will purge descendents first before deleting category " << cat_id << llendl; + LLPointer<LLInventoryCallback> wrap_cb = new LLRemoveCategoryOnDestroy(cat_id, cb); + purge_descendents_of(cat_id, wrap_cb); + return; + } LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RemoveInventoryFolder); |