From 802a985882532dd3bfa5497155f0097d201e4d46 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Wed, 20 Oct 2010 19:24:32 +0300
Subject: STORM-311 FIXED "Share" button in My Inventory SP was not updated on
 Current Outfit changes.

When you wear an inventory item, the code that disables/enables the button was called as soon
as the item got linked to COF, before it actually appeared on your avatar. However
to determine whether to enable the button, the code checked avatar appearence.

I fixed it to take the COF link into account, i.e. to treat items linked to COF as
worn (=not shareable), no matter has appearance been updated or not.
---
 indra/newview/llgiveinventory.cpp      | 4 ++--
 indra/newview/llinventoryfunctions.cpp | 5 +----
 2 files changed, 3 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp
index 260e15c714..f990b9294d 100644
--- a/indra/newview/llgiveinventory.cpp
+++ b/indra/newview/llgiveinventory.cpp
@@ -128,7 +128,7 @@ bool LLGiveInventory::isInventoryGiveAcceptable(const LLInventoryItem* item)
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
+		if (get_is_item_worn(item->getUUID()))
 		{
 			acceptable = false;
 		}
@@ -139,7 +139,7 @@ bool LLGiveInventory::isInventoryGiveAcceptable(const LLInventoryItem* item)
 			BOOL copyable = false;
 			if (item->getPermissions().allowCopyBy(gAgentID)) copyable = true;
 
-			if (!copyable && gAgentWearables.isWearingItem(item->getUUID()))
+			if (!copyable && get_is_item_worn(item->getUUID()))
 			{
 				acceptable = false;
 			}
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index f3d9639dee..ef20869114 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -487,12 +487,9 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(const LLInventoryIte
 			return false;
 			break;
 		case LLAssetType::AT_OBJECT:
-			if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
-				return true;
-			break;
 		case LLAssetType::AT_BODYPART:
 		case LLAssetType::AT_CLOTHING:
-			if(!gAgentWearables.isWearingItem(item->getUUID()))
+			if (!get_is_item_worn(item->getUUID()))
 				return true;
 			break;
 		default:
-- 
cgit v1.2.3


From 0d456a1ae7d523a3253a98212c420bd60c4a1f16 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Thu, 21 Oct 2010 20:57:43 +0300
Subject: STORM-224 FIXED Changed label "Fabric" to read "Texture" in wearable
 editing panels.

---
 indra/newview/skins/default/xui/en/panel_edit_gloves.xml     | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_jacket.xml     | 4 ++--
 indra/newview/skins/default/xui/en/panel_edit_pants.xml      | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_shirt.xml      | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_shoes.xml      | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_skirt.xml      | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_socks.xml      | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_underpants.xml | 2 +-
 indra/newview/skins/default/xui/en/panel_edit_undershirt.xml | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
index a490f27b9f..8c0c543d71 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
index 929cdffb3d..8e8d8e6505 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Upper Fabric"
+        label="Upper Texture"
         layout="topleft"
         left="25"
         name="Upper Fabric"
@@ -41,7 +41,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Lower Fabric"
+        label="Lower Texture"
         layout="topleft"
         left_pad="20"
         name="Lower Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pants.xml b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
index f22cf983aa..dd749a9259 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
index 85823073b5..5424b805e1 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
index b26fde68f1..859e7454a4 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
index bb8e0dca07..76d66cc5dc 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_socks.xml b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
index d813d94d93..5f978174b3 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
index 19225e9757..16f28377fb 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
@@ -26,7 +26,7 @@
              default_image_name="Default"
              follows="left|top"
              height="80"
-             label="Fabric"
+             label="Texture"
              layout="topleft"
              left="10"
              name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
index 720a55dcc2..059485cfb4 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
-- 
cgit v1.2.3


From 158bfc563b018ba4e0068ff4202f6d2ad1001aa1 Mon Sep 17 00:00:00 2001
From: Andrew Productengine <adyukov@productengine.com>
Date: Mon, 25 Oct 2010 18:56:04 +0300
Subject: STORM-95 FIXED Fixed hanging of client when incorrect WAV file was
 passed.

As Aimee has found: "The data chunk of nexfire.wav has an incorrect length specified in its header which we blindly trust when reading
the file in check_for_invalid_wav_formats() in llvorbisencode.cpp. It causes an overflow of the file position pointer when reading the file which makes
it start over from the beginning, hanging it in an infinite loop."

- To avoid this situation in future, check for chunk size was added, and if it is declared bigger then it may be, function is interrupted and returns error.
---
 indra/llaudio/llvorbisencode.cpp                     | 7 +++++++
 indra/llaudio/llvorbisencode.h                       | 1 +
 indra/newview/skins/default/xui/en/notifications.xml | 8 ++++++++
 3 files changed, 16 insertions(+)

(limited to 'indra')

diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp
index 9f479189d7..0e0c80a456 100644
--- a/indra/llaudio/llvorbisencode.cpp
+++ b/indra/llaudio/llvorbisencode.cpp
@@ -120,6 +120,13 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
 			+ ((U32) wav_header[5] << 8) 
 			+ wav_header[4];
 
+		if (chunk_length > physical_file_size - file_pos - 4)
+		{
+			infile.close();
+			error_msg = "SoundFileInvalidChunkSize";
+			return(LLVORBISENC_CHUNK_SIZE_ERR);
+		}
+
 //		llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl;
 
 		if (!(strncmp((char *)&(wav_header[0]),"fmt ",4)))
diff --git a/indra/llaudio/llvorbisencode.h b/indra/llaudio/llvorbisencode.h
index d33aacf1ea..6b22a2cb59 100644
--- a/indra/llaudio/llvorbisencode.h
+++ b/indra/llaudio/llvorbisencode.h
@@ -38,6 +38,7 @@ const S32 LLVORBISENC_MULTICHANNEL_ERR             = 7; // can't do stereo
 const S32 LLVORBISENC_UNSUPPORTED_SAMPLE_RATE      = 8; // unsupported sample rate
 const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE        = 9; // unsupported word size
 const S32 LLVORBISENC_CLIP_TOO_LONG                = 10; // source file is too long
+const S32 LLVORBISENC_CHUNK_SIZE_ERR               = 11; // chunk size is wrong
 
 const F32 LLVORBIS_CLIP_MAX_TIME                               = 10.0f;
 const U8  LLVORBIS_CLIP_MAX_CHANNELS                   = 2;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 83cbcb3344..4ee04b44b6 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1365,6 +1365,14 @@ Could not find &apos;data&apos; chunk in WAV header:
 [FILE]
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="SoundFileInvalidChunkSize"
+   type="alertmodal">
+Wrong chunk size in WAV file:
+[FILE]
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="SoundFileInvalidTooLong"
-- 
cgit v1.2.3


From ffe475e96e9cdd2bb3c66fd3ffeef2b4d64bc33b Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Tue, 26 Oct 2010 16:08:11 -0700
Subject: STORM-418 : Suppress menu items Save to XML and Load from XML from
 the Develop > XUI menu

---
 indra/newview/llviewermenu.cpp                     | 73 ----------------------
 indra/newview/skins/default/xui/en/menu_viewer.xml | 12 ----
 2 files changed, 85 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 68935d536b..1778eaed68 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -221,8 +221,6 @@ BOOL check_show_xui_names(void *);
 // Debug UI
 
 void handle_buy_currency_test(void*);
-void handle_save_to_xml(void*);
-void handle_load_from_xml(void*);
 
 void handle_god_mode(void*);
 
@@ -1384,37 +1382,6 @@ class LLAdvancedCheckDebugWindowProc : public view_listener_t
 
 // ------------------------------XUI MENU ---------------------------
 
-//////////////////////
-// LOAD UI FROM XML //
-//////////////////////
-
-
-class LLAdvancedLoadUIFromXML : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		handle_load_from_xml(NULL);
-		return true;
-}
-};
-
-
-
-////////////////////
-// SAVE UI TO XML //
-////////////////////
-
-
-class LLAdvancedSaveUIToXML : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		handle_save_to_xml(NULL);
-		return true;
-}
-};
-
-
 class LLAdvancedSendTestIms : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -7188,44 +7155,6 @@ const LLRect LLViewerMenuHolderGL::getMenuRect() const
 	return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT);
 }
 
-void handle_save_to_xml(void*)
-{
-	LLFloater* frontmost = gFloaterView->getFrontmost();
-	if (!frontmost)
-	{
-        LLNotificationsUtil::add("NoFrontmostFloater");
-		return;
-	}
-
-	std::string default_name = "floater_";
-	default_name += frontmost->getTitle();
-	default_name += ".xml";
-
-	LLStringUtil::toLower(default_name);
-	LLStringUtil::replaceChar(default_name, ' ', '_');
-	LLStringUtil::replaceChar(default_name, '/', '_');
-	LLStringUtil::replaceChar(default_name, ':', '_');
-	LLStringUtil::replaceChar(default_name, '"', '_');
-
-	LLFilePicker& picker = LLFilePicker::instance();
-	if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name))
-	{
-		std::string filename = picker.getFirstFile();
-		LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename);
-	}
-}
-
-void handle_load_from_xml(void*)
-{
-	LLFilePicker& picker = LLFilePicker::instance();
-	if (picker.getOpenFile(LLFilePicker::FFLOAD_XML))
-	{
-		std::string filename = picker.getFirstFile();
-		LLFloater* floater = new LLFloater(LLSD());
-		floater->buildFromFile(filename);
-	}
-}
-
 void handle_web_browser_test(const LLSD& param)
 {
 	std::string url = param.asString();
@@ -8011,8 +7940,6 @@ void initialize_menus()
 
 	// Advanced > XUI
 	commit.add("Advanced.ReloadColorSettings", boost::bind(&LLUIColorTable::loadFromSettings, LLUIColorTable::getInstance()));
-	view_listener_t::addMenu(new LLAdvancedLoadUIFromXML(), "Advanced.LoadUIFromXML");
-	view_listener_t::addMenu(new LLAdvancedSaveUIToXML(), "Advanced.SaveUIToXML");
 	view_listener_t::addMenu(new LLAdvancedToggleXUINames(), "Advanced.ToggleXUINames");
 	view_listener_t::addMenu(new LLAdvancedCheckXUINames(), "Advanced.CheckXUINames");
 	view_listener_t::addMenu(new LLAdvancedSendTestIms(), "Advanced.SendTestIMs");
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index ce628d93b5..43058a5ee3 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2761,18 +2761,6 @@
                  function="Floater.Show"
                  parameter="font_test" />
             </menu_item_call>
-            <menu_item_call
-             label="Load from XML"
-             name="Load from XML">
-                <menu_item_call.on_click
-                 function="Advanced.LoadUIFromXML" />
-            </menu_item_call>
-            <menu_item_call
-             label="Save to XML"
-             name="Save to XML">
-                <menu_item_call.on_click
-                 function="Advanced.SaveUIToXML" />
-            </menu_item_call>
             <menu_item_check
              label="Show XUI Names"
              name="Show XUI Names">
-- 
cgit v1.2.3


From 931584d4bfa2bd74baabb55e1212829e69993175 Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Wed, 27 Oct 2010 02:16:59 +0300
Subject: Backed out changeset: 330d0e96d58d STORM-296

---
 indra/newview/llplacesinventorypanel.cpp | 18 ------------------
 indra/newview/llplacesinventorypanel.h   |  6 ------
 2 files changed, 24 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
index 408270a1a0..29e262199e 100644
--- a/indra/newview/llplacesinventorypanel.cpp
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -205,24 +205,6 @@ BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	return LLFolderView::handleRightMouseDown(x, y, mask);
 }
 
-BOOL LLPlacesFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-										   EDragAndDropType cargo_type,
-										   void* cargo_data,
-										   EAcceptance* accept,
-										   std::string& tooltip_msg)
-{
-	// Don't accept anything except landmarks and folders to be dropped
-	// in places folder view. See STORM-296.
-	if (cargo_type != DAD_LANDMARK && cargo_type != DAD_CATEGORY)
-	{
-		*accept = ACCEPT_NO;
-		return FALSE;
-	}
-
-	return LLFolderView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data,
-										   accept, tooltip_msg);
-}
-
 void LLPlacesFolderView::setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle)
 {
 	mMenuHandlesByInventoryType[asset_type] = menu_handle;
diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h
index a44776d18b..6641871a0b 100644
--- a/indra/newview/llplacesinventorypanel.h
+++ b/indra/newview/llplacesinventorypanel.h
@@ -70,12 +70,6 @@ public:
 	 */
 	/*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
 
-	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-									   EDragAndDropType cargo_type,
-									   void* cargo_data,
-									   EAcceptance* accept,
-									   std::string& tooltip_msg);
-
 	void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
 
 	void setParentLandmarksPanel(LLLandmarksPanel* panel)
-- 
cgit v1.2.3


From 9c8ce6d6dc4ac09896a14b12d20fb53b22b693b3 Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Wed, 27 Oct 2010 19:01:38 +0300
Subject: STORM-296 FIXED Item types that can be dropped to Favorites and
 Landmarks restricted to landmarks and folders containing landmarks. This
 changes affect all folder views. The previous fix affecting only My Landmarks
 SP (changeset 330d0e96d58d) was reverted.

---
 indra/newview/llinventorybridge.cpp | 87 +++++++++++++++++++++++++++++++++----
 1 file changed, 79 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index b15dcd993a..e672892282 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1649,10 +1649,12 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		const LLUUID &cat_id = inv_cat->getUUID();
 		const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
 		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+		const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
 		
 		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
 		const BOOL move_is_into_outfit = getCategory() && (getCategory()->getPreferredType() == LLFolderType::FT_OUTFIT);
 		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+		const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
 
 		//--------------------------------------------------------------------------------
 		// Determine if folder can be moved.
@@ -1690,6 +1692,21 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				}
 			}
 		}
+		if (move_is_into_landmarks)
+		{
+			for (S32 i=0; i < descendent_items.count(); ++i)
+			{
+				LLViewerInventoryItem* item = descendent_items[i];
+
+				// Don't move anything except landmarks and categories into Landmarks folder.
+				// We use getType() instead of getActua;Type() to allow links to landmarks and folders.
+				if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType())
+				{
+					is_movable = FALSE;
+					break; // It's generally movable, but not into Landmarks.
+				}
+			}
+		}
 
 		// 
 		//--------------------------------------------------------------------------------
@@ -2661,6 +2678,8 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
 								EDragAndDropType cargo_type,
 								void* cargo_data)
 {
+	LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
+
 	//llinfos << "LLFolderBridge::dragOrDrop()" << llendl;
 	BOOL accept = FALSE;
 	switch(cargo_type)
@@ -2676,9 +2695,24 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
 		case DAD_BODYPART:
 		case DAD_ANIMATION:
 		case DAD_GESTURE:
+			accept = dragItemIntoFolder(inv_item, drop);
+			break;
 		case DAD_LINK:
-			accept = dragItemIntoFolder((LLInventoryItem*)cargo_data,
-										drop);
+			// DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER.
+			// If we have an item of AT_LINK_FOLDER type we should process the linked
+			// category being dragged or dropped into folder.
+			if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType())
+			{
+				LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID());
+				if (linked_category)
+				{
+					accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop);
+				}
+			}
+			else
+			{
+				accept = dragItemIntoFolder(inv_item, drop);
+			}
 			break;
 		case DAD_CATEGORY:
 			if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID))
@@ -2875,6 +2909,24 @@ static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_curr
 	return TRUE;
 }
 
+// Returns TRUE if item is a landmark or a link to a landmark
+// and can be moved to Favorites or Landmarks folder.
+static BOOL can_move_to_landmarks(LLInventoryItem* inv_item)
+{
+	// Need to get the linked item to know its type because LLInventoryItem::getType()
+	// returns actual type AT_LINK for links, not the asset type of a linked item.
+	if (LLAssetType::AT_LINK == inv_item->getType())
+	{
+		LLInventoryItem* linked_item = gInventory.getItem(inv_item->getLinkedUUID());
+		if (linked_item)
+		{
+			return LLAssetType::AT_LANDMARK == linked_item->getType();
+		}
+	}
+
+	return LLAssetType::AT_LANDMARK == inv_item->getType();
+}
+
 void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item)
 {
 	// use callback to rearrange favorite landmarks after adding
@@ -2931,9 +2983,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
 	const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
+	const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
 
 	const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+	const BOOL move_is_into_favorites = (mUUID == favorites_id);
 	const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+	const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
 	BOOL accept = FALSE;
@@ -2944,7 +2999,6 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
 		const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
-		const BOOL folder_allows_reorder = (mUUID == favorites_id);
 
 		//--------------------------------------------------------------------------------
 		// Determine if item can be moved.
@@ -2990,12 +3044,16 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 		if (!is_movable) 
 			accept = FALSE;
-		if ((mUUID == inv_item->getParentUUID()) && !folder_allows_reorder)
+		if ((mUUID == inv_item->getParentUUID()) && !move_is_into_favorites)
 			accept = FALSE;
 		if (move_is_into_current_outfit || move_is_into_outfit)
 		{
 			accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
 		}
+		else if (move_is_into_favorites || move_is_into_landmarks)
+		{
+			accept = can_move_to_landmarks(inv_item);
+		}
 
 		if(accept && drop)
 		{
@@ -3021,8 +3079,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			// 
 
 			// REORDER
-			// (only reorder the item)
-			if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder)
+			// (only reorder the item in Favorites folder)
+			if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites)
 			{
 				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
 				LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
@@ -3036,7 +3094,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 			// FAVORITES folder
 			// (copy the item)
-			else if (favorites_id == mUUID)
+			else if (move_is_into_favorites)
 			{
 				dropToFavorites(inv_item);
 			}
@@ -3101,6 +3159,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		{
 			accept = FALSE;
 		}
+		// Don't allow to move a single item to Favorites or Landmarks
+		// if it is not a landmark or a link to a landmark.
+		else if ((move_is_into_favorites || move_is_into_landmarks)
+				 && !can_move_to_landmarks(inv_item))
+		{
+			accept = FALSE;
+		}
 
 		if(drop && accept)
 		{
@@ -3146,12 +3211,18 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			{
 				accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
 			}
+			// Don't allow to move a single item to Favorites or Landmarks
+			// if it is not a landmark or a link to a landmark.
+			else if (move_is_into_favorites || move_is_into_landmarks)
+			{
+				accept = can_move_to_landmarks(inv_item);
+			}
 
 			if (accept && drop)
 			{
 				// FAVORITES folder
 				// (copy the item)
-				if (favorites_id == mUUID)
+				if (move_is_into_favorites)
 				{
 					dropToFavorites(inv_item);
 				}
-- 
cgit v1.2.3


From ea32129f493712fd8d03d8c3454f78f89f268e61 Mon Sep 17 00:00:00 2001
From: Andrew Productengine <adyukov@productengine.com>
Date: Wed, 27 Oct 2010 19:23:52 +0300
Subject: STORM-452 FIXED Made protective fix for crash in
 LLAgentCamera::resetView().

I managed to reprodcuce the crash once and couldn't reproduce it any time later, so this fix is made judging from line that I found (viewer was in debug mode when it happened)
in call stack after crash. Added check for gMenuHolder against NULL to prevent further crashing. There is no 100% guarantee that this fixes the crash from ticket, but it won't do any harm either.
---
 indra/newview/llagentcamera.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 68e408d3e4..7c953cd2dc 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -296,8 +296,11 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera)
 			LLSelectMgr::getInstance()->deselectAll();
 		}
 
-		// Hide all popup menus
-		gMenuHolder->hideMenus();
+		if (gMenuHolder != NULL)
+		{
+			// Hide all popup menus
+			gMenuHolder->hideMenus();
+		}
 	}
 
 	if (change_camera && !gSavedSettings.getBOOL("FreezeTime"))
-- 
cgit v1.2.3