diff options
author | ayp <none@none> | 2009-10-27 18:12:06 +0200 |
---|---|---|
committer | ayp <none@none> | 2009-10-27 18:12:06 +0200 |
commit | d8802ba0fd7ac65d240070ec5e7d17afbcd9e196 (patch) | |
tree | d3171a8e2601a1d4663bb196613efed1f0303033 /indra/newview/llfavoritesbar.cpp | |
parent | bfc9445563c5ad200ed609bc8ff3edecb2398d28 (diff) |
fixed major bug EXT-1765 Viewer crahes if drop landmark from notecard onto Favorites Bar
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llfavoritesbar.cpp')
-rw-r--r-- | indra/newview/llfavoritesbar.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 3b5b7f570e..a6afbc05be 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -503,13 +503,15 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con return; } + LLPointer<LLViewerInventoryItem> viewer_item = new LLViewerInventoryItem(item); + if (dest) { - insertBeforeItem(mItems, dest->getLandmarkId(), item->getUUID()); + insertBeforeItem(mItems, dest->getLandmarkId(), viewer_item); } else { - mItems.push_back(gInventory.getItem(item->getUUID())); + mItems.push_back(viewer_item); } int sortField = 0; @@ -534,13 +536,22 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con } } - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - favorites_id, - std::string(), - cb); + LLToolDragAndDrop* tool_dad = LLToolDragAndDrop::getInstance(); + if (tool_dad->getSource() == LLToolDragAndDrop::SOURCE_NOTECARD) + { + viewer_item->setType(LLAssetType::AT_FAVORITE); + copy_inventory_from_notecard(tool_dad->getObjectID(), tool_dad->getSourceID(), viewer_item.get(), gInventoryCallbacks.registerCB(cb)); + } + else + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + favorites_id, + std::string(), + cb); + } llinfos << "Copied inventory item #" << item->getUUID() << " to favorites." << llendl; } @@ -1263,10 +1274,9 @@ void LLFavoritesBarCtrl::updateItemsOrder(LLInventoryModel::item_array_t& items, items.insert(findItemByUUID(items, destItem->getUUID()), srcItem); } -void LLFavoritesBarCtrl::insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, const LLUUID& insertedItemId) +void LLFavoritesBarCtrl::insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, LLViewerInventoryItem* insertedItem) { LLViewerInventoryItem* beforeItem = gInventory.getItem(beforeItemId); - LLViewerInventoryItem* insertedItem = gInventory.getItem(insertedItemId); items.insert(findItemByUUID(items, beforeItem->getUUID()), insertedItem); } |