From c07901e29ed545bbb02e3bddf148fe1104b94e9f Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:56 -0500 Subject: Second Life viewer sources 1.15.1.3 --- linden/indra/newview/llinventorybridge.cpp | 85 +++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 26 deletions(-) (limited to 'linden/indra/newview/llinventorybridge.cpp') diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp index 05334d7..a7b80ae 100644 --- a/linden/indra/newview/llinventorybridge.cpp +++ b/linden/indra/newview/llinventorybridge.cpp @@ -569,10 +569,10 @@ const char* safe_inv_type_lookup(LLInventoryType::EType inv_type) } LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, - LLInventoryPanel* inventory, - const LLUUID& uuid, - U32 flags) + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + const LLUUID& uuid, + U32 flags) { LLInvFVBridge* new_listener = NULL; switch(asset_type) @@ -677,7 +677,11 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, break; } - new_listener->mInvType = inv_type; + if (new_listener) + { + new_listener->mInvType = inv_type; + } + return new_listener; } @@ -907,16 +911,20 @@ BOOL LLItemBridge::removeItem() if(!model) return FALSE; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); LLViewerInventoryItem* item = getItem(); - if(item) + + // if item is not already in trash + if(item && !model->isObjectDescendentOf(mUUID, trash_id)) { - // restamp on move to trash. + // move to trash, and restamp LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE); + // delete was successful + return TRUE; + } + else + { + // tried to delete already item in trash (should purge?) + return FALSE; } - - // return false anyway, so that if it's called from the folder - // view, it doesn't remove the view - it's just being moved to the - // trash. - return FALSE; } BOOL LLItemBridge::isItemCopyable() const @@ -1462,11 +1470,20 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) { LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); - if (category->getDescendentCount() == mContentsCount) + if (NULL == category) { - gInventory.removeObserver(this); - wear_inventory_category(category, FALSE, TRUE); - delete this; + llwarns << "gInventory.getCategory(" << mCatID + << ") was NULL" << llendl; + } + else + { + if (category->getDescendentCount() == + mContentsCount) + { + gInventory.removeObserver(this); + wear_inventory_category(category, FALSE, TRUE); + delete this; + } } } @@ -1682,11 +1699,7 @@ BOOL LLFolderBridge::removeItem() LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE); } - // return false anyway, so that if it's called from the folder - // view, it doesn't remove the view - it's just being moved to the - // trash. - return FALSE; - + return TRUE; } BOOL LLFolderBridge::isClipboardPasteable() const @@ -2178,10 +2191,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // everything in the active window so that we don't follow // the selection to its new location (which is very // annoying). - LLInventoryPanel* active_panel = LLInventoryView::getActiveInventory()->getPanel(); - if (mInventoryPanel != active_panel) + if (LLInventoryView::getActiveInventory()) { - active_panel->unSelectAll(); + LLInventoryPanel* active_panel = LLInventoryView::getActiveInventory()->getPanel(); + if (active_panel && (mInventoryPanel != active_panel)) + { + active_panel->unSelectAll(); + } } // restamp if the move is into the trash. @@ -3117,7 +3133,16 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); } // this object might have been selected, so let the selection manager know it's gone now - gSelectMgr->remove(gObjectList.findObject(item->getUUID())); + LLViewerObject *found_obj = + gObjectList.findObject(item->getUUID()); + if (found_obj) + { + gSelectMgr->remove(found_obj); + } + else + { + llwarns << "object not found - ignoring" << llendl; + } } else LLItemBridge::performAction(folder, model, action); } @@ -4027,7 +4052,15 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); // this object might have been selected, so let the selection manager know it's gone now - gSelectMgr->remove(gObjectList.findObject( obj_item_array.get(i)->getUUID()) ); + LLViewerObject *found_obj = gObjectList.findObject( obj_item_array.get(i)->getUUID()); + if (found_obj) + { + gSelectMgr->remove(found_obj); + } + else + { + llwarns << "object not found, ignoring" << llendl; + } } } -- cgit v1.1