diff --git a/.hgtags b/.hgtags
index d0b08ec1ea3c488d62f588f1bad6069b0d1699cf..08f079a3a1e929a292c4dd519c429b6ba9478945 100755
--- a/.hgtags
+++ b/.hgtags
@@ -478,3 +478,4 @@ b842534cb4d76c9ef87676a62b1d2d19e79c015f 3.7.2-release
 962d3f98955bfc7310a7867c8cbc3df075e54aa9 3.7.3-release
 d076568ff7883b41c149e6afb421f39c29dbfe2b 3.7.4-release
 fc066b82343fca51f9c1b8eda0abc6bee9bb4503 3.7.5-release
+d029faf69f20a23007f32420a1ac6a3b89a6d441 3.7.6-release
diff --git a/BuildParams b/BuildParams
index 7a6542dadcb959326a30bba1cd7a253af9ecef99..51434a49126162bb39d5b2346422dee3fc3490f9 100755
--- a/BuildParams
+++ b/BuildParams
@@ -167,6 +167,14 @@ simon_viewer-dev-private.email_status_this_is_os = false
 # ========================================
 vir-project-1.viewer_channel = "Second Life Release"
 
+# ========================================
+# Merov
+# ========================================
+merov-viewer-maint-2287.viewer_channel = "Second Life Project Merchant Outbox"
+merov-viewer-maint-2287.login_channel = "Second Life Project Merchant Outbox"
+merov-viewer-maint-2287.build_viewer_update_version_manager = false
+merov-viewer-maint-2287.codeticket_add_context = false
+
 # ========================================
 # THX-1138 / Runway projects
 # ========================================
diff --git a/autobuild.xml b/autobuild.xml
index cd2a0855202abc0fd4cf446370f4312274c15384..468a7c6182b09315f9fdd4ee9cd20daf0338225f 100755
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1808,9 +1808,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>2994f1e028fb200c454c12b5f7ca9108</string>
+              <string>88181b9f66b7db650e0d571bbb632bdc</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-slvoice/rev/270464/arch/Darwin/installer/slvoice-4.5.0009.17865-darwin-20130215.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-slvoice/rev/287264/arch/Darwin/installer/slvoice-4.6.0009.20030-darwin-20140226.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -1832,9 +1832,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>24710eda136bfd42d6333e5609c2c74f</string>
+              <string>ce89b881ee24977641d1ecbf8aff6dc7</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-slvoice/rev/270464/arch/CYGWIN/installer/slvoice-4.5.0009.17865-windows-20130214.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-slvoice/rev/287264/arch/CYGWIN/installer/slvoice-4.6.0009.20030-windows-20140227.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 4cf82a3740d4c767dfbfe8883e28446aa6908416..63d01999f0610c3cc843bc47917d91852e7bb79b 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -1973,10 +1973,7 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name,
 	}
 	else
 	{
-		if (!gTextureManagerBridgep)
-		{
-			return LLPointer<LLGLTexture>();
-		}
+		llassert(gTextureManagerBridgep);
 		tex = gTextureManagerBridgep->getLocalTexture( FALSE );
 		LLPointer<LLImageRaw> image_raw = new LLImageRaw;
 		if( loadImageRaw( file_name, image_raw ) )
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 61cd995cea1f0307ee8c0c4bd5eb1666130f9f1f..d86a460511fba4cb052b8d40029dae735488e08b 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -420,12 +420,6 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream,
 				return LLWearable::FAILURE;
 		}
 		LLUUID id = LLUUID(uuid_buffer);
-
-		if (!gTextureManagerBridgep)
-		{
-			continue;
-		}
-
 		LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id );
 		if( mTEMap.find(te) != mTEMap.end() )
 		{
@@ -598,10 +592,7 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
 			{
 				// there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
 				image_id = getDefaultTextureImageID((ETextureIndex) te);
-				if (gTextureManagerBridgep)
-				{
-					image = gTextureManagerBridgep->getFetchedTexture( image_id );
-				}
+				image = gTextureManagerBridgep->getFetchedTexture( image_id );
 			}
 
 			if( dst.find(te) != dst.end() )
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 5c8fff051f53886f57ad3d4db183e889bb9305c7..63a38f2884e1ceac084c224fe746c8307676cc13 100755
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -320,7 +320,7 @@ void EnableCrashingOnCrashes()
 }
 #endif
 
-void LLApp::setupErrorHandling()
+void LLApp::setupErrorHandling(bool second_instance)
 {
 	// Error handling is done by starting up an error handling thread, which just sleeps and
 	// occasionally checks to see if the app is in an error state, and sees if it needs to be run.
@@ -337,40 +337,52 @@ void LLApp::setupErrorHandling()
 	// Install the Google Breakpad crash handler for Windows
 	if(mExceptionHandler == 0)
 	{
-		llwarns << "adding breakpad exception handler" << llendl;
+		if ( second_instance )  //BUG-5707 Firing teleport from a web browser causes second 
+		{
+			mExceptionHandler = new google_breakpad::ExceptionHandler(
+															L"C:\\Temp\\",		
+															0,		//No filter
+															windows_post_minidump_callback,
+															0,
+															google_breakpad::ExceptionHandler::HANDLER_ALL);  //No custom client info.
+		}
+		else
+		{
+			llwarns << "adding breakpad exception handler" << llendl;
 
-		std::wstring wpipe_name;
-		wpipe_name =  mCrashReportPipeStr + wstringize(getPid());
+			std::wstring wpipe_name;
+			wpipe_name =  mCrashReportPipeStr + wstringize(getPid());
 
-		const std::wstring wdump_path(wstringize(mDumpPath));
+			const std::wstring wdump_path(wstringize(mDumpPath));
 
-		int retries = 30;
-		for (; retries > 0; --retries)
-		{
-			if (mExceptionHandler != 0) delete mExceptionHandler;
-
-			mExceptionHandler = new google_breakpad::ExceptionHandler(
-														wdump_path,		
-														NULL,		//No filter
-														windows_post_minidump_callback,
-														0,
-														google_breakpad::ExceptionHandler::HANDLER_ALL,
-														MiniDumpNormal, //Generate a 'normal' minidump.
-														wpipe_name.c_str(),
-														NULL);  //No custom client info.
-			if (mExceptionHandler->IsOutOfProcess())
+			int retries = 30;
+			for (; retries > 0; --retries)
 			{
-				LL_INFOS("CRASHREPORT") << "Successfully attached to Out of Process exception handler." << LL_ENDL;
-				break;
-			}
-			else
-			{
-				LL_WARNS("CRASHREPORT") << "Unable to attach to Out of Process exception handler.  " << retries << " retries remaining." << LL_ENDL; 
-				::Sleep(100);  //Wait a tick and try again.
+				if (mExceptionHandler != 0) delete mExceptionHandler;
+
+				mExceptionHandler = new google_breakpad::ExceptionHandler(
+															wdump_path,		
+															NULL,		//No filter
+															windows_post_minidump_callback,
+															0,
+															google_breakpad::ExceptionHandler::HANDLER_ALL,
+															MiniDumpNormal, //Generate a 'normal' minidump.
+															wpipe_name.c_str(),
+															NULL);  //No custom client info.
+				if (mExceptionHandler->IsOutOfProcess())
+				{
+					LL_INFOS("CRASHREPORT") << "Successfully attached to Out of Process exception handler." << LL_ENDL;
+					break;
+				}
+				else
+				{
+					LL_WARNS("CRASHREPORT") << "Unable to attach to Out of Process exception handler.  " << retries << " retries remaining." << LL_ENDL; 
+					::Sleep(100);  //Wait a tick and try again.
+				}
 			}
-		}
 
-		if (retries == 0) LL_WARNS("CRASHREPORT") << "Unable to attach to Out of Process exception handler." << LL_ENDL;
+			if (retries == 0) LL_WARNS("CRASHREPORT") << "Unable to attach to Out of Process exception handler." << LL_ENDL;
+		}
 
 		if (mExceptionHandler)
 		{
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index 828965b1fabfdd4ea26da3c7971a1dfd8c3fb39f..3f7bf2ca476d4c9a2a33cfc7949035ec7b544da4 100755
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -214,7 +214,7 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 	 * DO NOT call this method if your application has specialized
 	 * error handling code.
 	 */
-	void setupErrorHandling();
+	void setupErrorHandling(bool mSecondInstance=false);
 
 	void setErrorHandler(LLAppErrorHandler handler);
 	static void runErrorHandler(); // run shortly after we detect an error, ran in the relatively robust context of the LLErrorThread - preferred.
diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp
index f6d0f5bce89f596685e13c78ba52386ad158f8c4..9c38349cf722405b57189cb6fd22acf158ec0db3 100755
--- a/indra/llcommon/llfoldertype.cpp
+++ b/indra/llcommon/llfoldertype.cpp
@@ -92,8 +92,9 @@ LLFolderDictionary::LLFolderDictionary()
 
 	addEntry(LLFolderType::FT_MESH, 				new FolderEntry("mesh",	TRUE));
 
-	addEntry(LLFolderType::FT_INBOX, 				new FolderEntry("inbox",	TRUE));
-	addEntry(LLFolderType::FT_OUTBOX, 				new FolderEntry("outbox",	TRUE));
+	addEntry(LLFolderType::FT_INBOX, 				new FolderEntry("inbox",	FALSE));
+	addEntry(LLFolderType::FT_OUTBOX, 				new FolderEntry("outbox",	FALSE));
+	
 	addEntry(LLFolderType::FT_BASIC_ROOT,			new FolderEntry("basic_rt", TRUE));
 		 
 	addEntry(LLFolderType::FT_NONE, 				new FolderEntry("-1",		FALSE));
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 183620f9bc04d55e87264324c298d7548a738eb3..c8a05e1faea6e0244ecc03f88c325bc7f5570879 100755
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -230,7 +230,7 @@ const U8* LLImageBase::getData() const
 { 
 	if(mBadBufferAllocation)
 	{
-		llwarns << "Bad memory allocation for the image buffer!" << llendl ;
+		llerrs << "Bad memory allocation for the image buffer!" << llendl ;
 	}
 
 	return mData; 
@@ -240,7 +240,7 @@ U8* LLImageBase::getData()
 { 
 	if(mBadBufferAllocation)
 	{
-		llwarns << "Bad memory allocation for the image buffer!" << llendl ;
+		llerrs << "Bad memory allocation for the image buffer!" << llendl ;
 	}
 
 	return mData; 
@@ -293,7 +293,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_c
 	{
 		setDataAndSize(data, width, height, components);
 	}
-	else if(allocateDataSize(width, height, components) && getData())
+	else if(allocateDataSize(width, height, components))
 	{
 		memcpy(getData(), data, width*height*components);
 	}
@@ -431,11 +431,6 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a)
 // Reverses the order of the rows in the image
 void LLImageRaw::verticalFlip()
 {
-	if (!getData())
-	{
-		return;
-	}
-
 	S32 row_bytes = getWidth() * getComponents();
 	llassert(row_bytes > 0);
 	std::vector<U8> line_buffer(row_bytes);
@@ -671,11 +666,6 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill)
 // Fill the buffer with a constant color
 void LLImageRaw::fill( const LLColor4U& color )
 {
-	if (!getData())
-	{
-		return;
-	}
-
 	S32 pixels = getWidth() * getHeight();
 	if( 4 == getComponents() )
 	{
@@ -877,11 +867,6 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
 
 BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
 {
-	if (!getData())
-	{
-		return FALSE;
-	}
-
 	llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) );
 
 	S32 old_width = getWidth();
@@ -916,7 +901,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
 			copyLineScaled( &temp_buffer[0] + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 );
 		}
 	}
-	else if (getData())
+	else
 	{
 		// copy	out	existing image data
 		S32	temp_data_size = old_width * old_height	* getComponents();
@@ -1579,11 +1564,6 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size)
 
 BOOL LLImageFormatted::save(const std::string &filename)
 {
-	if (!getData())
-	{
-		return FALSE;
-	}
-
 	resetLastError();
 
 	LLAPRFile outfile ;
diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp
index 148cf4fa55f9f809774a8c749af488b83c038a1b..ad2eb0f69c56e1f9968940707f2b11567765d10f 100755
--- a/indra/llimage/llimageworker.cpp
+++ b/indra/llimage/llimageworker.cpp
@@ -142,12 +142,8 @@ bool LLImageDecodeThread::ImageRequest::processRequest()
 											  mFormattedImage->getHeight(),
 											  mFormattedImage->getComponents());
 		}
-
-		if (mDecodedImageRaw->getData())
-		{
-			done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms
-			mDecodedRaw = done;
-		}
+		done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms
+		mDecodedRaw = done;
 	}
 	if (done && mNeedsAux && !mDecodedAux && mFormattedImage.notNull())
 	{
@@ -158,12 +154,8 @@ bool LLImageDecodeThread::ImageRequest::processRequest()
 											  mFormattedImage->getHeight(),
 											  1);
 		}
-
-		if (mDecodedImageAux->getData())
-		{
-			done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms
-			mDecodedAux = done;
-		}
+		done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms
+		mDecodedAux = done;
 	}
 
 	return done;
diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp
index f6fb8f54b48c049ea9b7178089c0c0404ccc9fc8..e255d65b43bca62c3705325204787d80113defc7 100755
--- a/indra/llimage/tests/llimageworker_test.cpp
+++ b/indra/llimage/tests/llimageworker_test.cpp
@@ -58,7 +58,6 @@ void LLImageBase::sanityCheck() { }
 void LLImageBase::deleteData() { }
 U8* LLImageBase::allocateData(S32 size) { return NULL; }
 U8* LLImageBase::reallocateData(S32 size) { return NULL; }
-U8* LLImageBase::getData() { return NULL; }
 
 LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components) { }
 LLImageRaw::~LLImageRaw() { }
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp
index 0dad4285d93a6bcf223722e20642547b95f6f249..45a3b18179a8aff6b2646aaf02e5aea96bf05add 100755
--- a/indra/llrender/llcubemap.cpp
+++ b/indra/llrender/llcubemap.cpp
@@ -116,11 +116,6 @@ void LLCubeMap::initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages
 		const U8 *sd = rawimages[i]->getData();
 		U8 *td = mRawImages[i]->getData();
 
-		if (!sd || !td)
-		{
-			continue;
-		}
-
 		S32 offset = 0;
 		S32 sx, sy, so;
 		for (int y = 0; y < 64; y++)
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 7ab4e93da5daf000a2d02f8698a935ce0f89d2be..84c782e958137a2f6d35f84d0de4fee3dd6939a1 100755
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -448,11 +448,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l
 	
 	LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num);
 	LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
-	
-	if (image_gl)
-	{
-		image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
-	}
+	image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
 
 	return gi;
 }
@@ -564,18 +560,13 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32
 {
 	LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
 
-	if (!image_raw)
-	{
-		return;
-	}
-
 	llassert(!mIsFallback);
-	llassert(image_raw->getComponents() == 2);
+	llassert(image_raw && (image_raw->getComponents() == 2));
 
 	
 	U8 *target = image_raw->getData();
 
-	if (!data || !target)
+	if (!data)
 	{
 		return;
 	}
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 315cc57e517d7211eb5de695dee55dde4687f7a2..ab875141c57dc2469744344242ab797daecc2405 100755
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1251,11 +1251,6 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
 		return FALSE;
 	}
 
-	if (!imageraw->getData())
-	{
-		return FALSE;
-	}
-
 	mGLTextureCreated = false ;
 	llassert(gGLManager.mInited);
 	stop_glerror();
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index c9ea0c0e1b16c09ccd1c34e97a012564cae8cad6..ddc0e595bb33cd9f7ce6df683b4cdff6ce80e675 100755
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -167,13 +167,14 @@ LLFolderView::LLFolderView(const Params& p)
 	mMinWidth(0),
 	mDragAndDropThisFrame(FALSE),
 	mCallbackRegistrar(NULL),
-	mParentPanel(p.parent_panel),
 	mUseEllipses(p.use_ellipses),
 	mDraggingOverItem(NULL),
 	mStatusTextBox(NULL),
 	mShowItemLinkOverlays(p.show_item_link_overlays),
 	mViewModel(p.view_model)
 {
+    LLPanel* panel = p.parent_panel;
+    mParentPanel = panel->getHandle();
 	mViewModel->setFolderView(this);
 	mRoot = this;
 
@@ -264,6 +265,7 @@ LLFolderView::~LLFolderView( void )
 	mItems.clear();
 	mFolders.clear();
 
+	//mViewModel->setFolderView(NULL);
 	mViewModel = NULL;
 }
 
@@ -325,7 +327,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter )
 {
     // Entry point of inventory filtering (CHUI-849)
 	LLFastTimer t2(FTM_FILTER);
-    filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
+    filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
 
     // Note: we filter the model, not the view
 	getViewModelItem()->filter(filter);
@@ -419,7 +421,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
 
 	if( selection && take_keyboard_focus)
 	{
-		mParentPanel->setFocus(TRUE);
+		mParentPanel.get()->setFocus(TRUE);
 	}
 
 	// clear selection down here because change of keyboard focus can potentially
@@ -759,7 +761,7 @@ void LLFolderView::removeSelectedItems()
 				if (item_to_delete->remove())
 				{
 					// change selection on successful delete
-					setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
+					setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus());
 				}
 			}
 			arrangeAll();
@@ -769,7 +771,7 @@ void LLFolderView::removeSelectedItems()
 			LLDynamicArray<LLFolderViewModelItem*> listeners;
 			LLFolderViewModelItem* listener;
 
-			setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
+			setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus());
 
 			for(S32 i = 0; i < count; ++i)
 			{
@@ -949,7 +951,7 @@ void LLFolderView::cut()
 		}
 		
 		// Update the selection
-		setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
+		setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus());
 	}
 	mSearchString.clear();
 }
@@ -1289,7 +1291,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
 	}
 
 	BOOL handled = FALSE;
-	if (mParentPanel->hasFocus())
+	if (mParentPanel.get()->hasFocus())
 	{
 		// SL-51858: Key presses are not being passed to the Popup menu.
 		// A proper fix is non-trivial so instead just close the menu.
@@ -1323,7 +1325,7 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask )
 	mKeyboardSelection = FALSE;
 	mSearchString.clear();
 
-	mParentPanel->setFocus(TRUE);
+	mParentPanel.get()->setFocus(TRUE);
 
 	LLEditMenuHandler::gEditMenuHandler = this;
 
@@ -1406,7 +1408,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
 {
 	// all user operations move keyboard focus to inventory
 	// this way, we know when to stop auto-updating a search
-	mParentPanel->setFocus(TRUE);
+	mParentPanel.get()->setFocus(TRUE);
 
 	BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL;
 	S32 count = mSelectedItems.size();
@@ -1598,6 +1600,12 @@ void LLFolderView::update()
 	// If this is associated with the user's inventory, don't do anything
 	// until that inventory is loaded up.
 	LLFastTimer t2(FTM_INVENTORY);
+    
+    // If there's no model, the view is in suspended state (being deleted) and shouldn't be updated
+    if (getFolderViewModel() == NULL)
+    {
+        return;
+    }
 
 	LLFolderViewFilter& filter_object = getFolderViewModel()->getFilter();
 
@@ -1646,8 +1654,8 @@ void LLFolderView::update()
 	BOOL filter_finished = getViewModelItem()->passedFilter()
 						&& mViewModel->contentsReady();
 	if (filter_finished 
-		|| gFocusMgr.childHasKeyboardFocus(mParentPanel)
-		|| gFocusMgr.childHasMouseCapture(mParentPanel))
+		|| gFocusMgr.childHasKeyboardFocus(mParentPanel.get())
+		|| gFocusMgr.childHasMouseCapture(mParentPanel.get()))
 	{
 		// finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process
 		mNeedsAutoSelect = FALSE;
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index c28660819f2097add2b264de1fa10b82944777bf..8729bce752a71ebd5f14be4b8e3182c18940cd7d 100755
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -229,7 +229,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; }
 
-	LLPanel* getParentPanel() { return mParentPanel; }
+	LLPanel* getParentPanel() { return mParentPanel.get(); }
 	// DEBUG only
 	void dumpSelectionInformation();
 
@@ -238,6 +238,9 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	bool useLabelSuffix() { return mUseLabelSuffix; }
 	virtual void updateMenu();
 
+    // Note: We may eventually have to move that method up the hierarchy to LLFolderViewItem.
+	LLHandle<LLFolderView>	getHandle() const { return getDerivedHandle<LLFolderView>(); }
+    
 private:
 	void updateMenuOptions(LLMenuGL* menu);
 	void updateRenamerPosition();
@@ -295,7 +298,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	S32								mMinWidth;
 	BOOL							mDragAndDropThisFrame;
 	
-	LLPanel*						mParentPanel;
+	LLHandle<LLPanel>               mParentPanel;
 	
 	LLFolderViewModelInterface*		mViewModel;
 
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index 897e56be0b6911813b9baecd20ea8de49244b917..d2577d975622d5415d4d59199a92a798af3c09cc 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-3.7.6
+3.7.7
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index dfbf6b0156085322cdc517b9e9e3c87b01d57961..5bfe19e23cdf9db3759afcb590b0ef3686d6916c 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4655,6 +4655,17 @@
 		<key>Value</key>
 		<integer>0</integer>
 	</map>
+	<key>InventoryOutboxMakeVisible</key>
+	<map>
+		<key>Comment</key>
+		<string>Enable making the Merchant Outbox and Inbox visible in the inventory for debug purposes.</string>
+		<key>Persist</key>
+		<integer>1</integer>
+		<key>Type</key>
+		<string>Boolean</string>
+		<key>Value</key>
+		<integer>0</integer>
+	</map>
     <key>InventoryOutboxMaxFolderCount</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index c98e7d1cd3779310fa90f239d176da122d91f5c6..bc63d07d726ccda9dee47a148166cd0592cea4be 100755
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -33,8 +33,8 @@ mat4 getSkinnedTransform()
 	mat4 ret;
 	int i = int(floor(weight.x));
 	float x = fract(weight.x);
-	
-	ret[0] = mix(matrixPalette[i+0], matrixPalette[i+1],  x);
+		
+	ret[0] = mix(matrixPalette[i+0], matrixPalette[i+1], x);
 	ret[1] = mix(matrixPalette[i+15],matrixPalette[i+16], x);
 	ret[2] = mix(matrixPalette[i+30],matrixPalette[i+31], x);
 	ret[3] = vec4(0,0,0,1);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
index a74290bfcd0c60ba2f123e535f862ed017e18f62..24871106242a9e334dfc470a4968e9ca21fe857e 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
@@ -40,7 +40,7 @@ mat4 getObjectSkinnedTransform();
 void main()
 {
 	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-	
+		
 	mat4 mat = getObjectSkinnedTransform();
 	
 	mat = modelview_matrix * mat;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 656ab6a42235e618eacbebeb4355c878f9ab2284..201450ac773314bed37184b2ab0641f2470a5b9c 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -740,7 +740,7 @@ class LLUITranslationBridge : public LLTranslationBridge
 
 bool LLAppViewer::init()
 {	
-	setupErrorHandling();
+	setupErrorHandling(mSecondInstance);
 
 	//
 	// Start of the application
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index cbaa7bc4c2719036693c81cb55078ba80ab496be..25b5c90bb05ad737b6e19ef7829413333b7b664f 100755
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -80,6 +80,7 @@ class LLAppViewer : public LLApp
 
     bool quitRequested() { return mQuitRequested; }
     bool logoutRequestSent() { return mLogoutRequestSent; }
+	bool isSecondInstance() { return mSecondInstance; }
 
 	void writeDebugInfo(bool isStatic=true);
 
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index d9a0eb25e490a3f5d6f68d731fcfd6869de351f3..5585bd914c79c810b9614362e2b47f8876bde611 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -674,6 +674,8 @@ bool LLAppViewerWin32::restoreErrorTrap()
 
 void LLAppViewerWin32::initCrashReporting(bool reportFreeze)
 {
+	if (isSecondInstance()) return; //BUG-5707 do not start another crash reporter for second instance.
+
 	const char* logger_name = "win_crash_logger.exe";
 	std::string exe_path = gDirUtilp->getExecutableDir();
 	exe_path += gDirUtilp->getDirDelimiter();
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 70cc48f12b8fddef99008917a2e341295eee5e3f..307e72fe18cc1a1d49a2ac58e68db50a6200a633 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -868,6 +868,10 @@ bool LLAvatarActions::canShareSelectedItems(LLInventoryPanel* inv_panel /* = NUL
 
 	// check selection in the panel
 	LLFolderView* root_folder = inv_panel->getRootFolder();
+    if (!root_folder)
+    {
+        return false;
+    }
 	const std::set<LLFolderViewItem*> inventory_selected = root_folder->getSelectionList();
 	if (inventory_selected.empty()) return false; // nothing selected
 
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 24f467f95429434a62056509901e9449392d1db6..716243b381931ed663ebc4bcc08452705a79f91c 100755
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1517,6 +1517,17 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer<LLVertexBuffer>
 		face->setPoolType(LLDrawPool::POOL_AVATAR);
 	}
 
+	//let getGeometryVolume know if a texture matrix is in play
+	if (face->mTextureMatrix)
+	{
+		face->setState(LLFace::TEXTURE_ANIM);
+	}
+	else
+	{
+		face->clearState(LLFace::TEXTURE_ANIM);
+	}
+
+
 	//llinfos << "Rebuilt face " << face->getTEOffset() << " of " << face->getDrawable() << " at " << gFrameTimeSeconds << llendl;
 	face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true);
 
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 24fe1dd75ffd16e1bd13c7f596740f4913534344..79a81ceddafae44bda1ce88287af3faa91f9000d 100755
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1232,7 +1232,6 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
 
 		//if (iter->second->getWidth() != src->getWidth() ||
 		//	iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
-		if (src->getData())
 		{
 			LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
 			U8* dst_data = dst_image->getData();
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index d7ecacf2e677c1446af8e4b250e85b994e3224b3..c3ec23422310786c2176ab2d970709cfd2b49f3f 100755
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -88,11 +88,8 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
 	//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
 	m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
 	
-	if (mTexturep)
-	{
-		mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
-	}
-
+	mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
+	
 	//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 }
 
@@ -854,18 +851,11 @@ void LLDrawPoolTerrain::renderSimple()
 	// Pass 1/1
 
 	// Stage 0: Base terrain texture pass
-	if (mTexturep)
-	{
-		mTexturep->addTextureStats(1024.f*1024.f);
-	}
+	mTexturep->addTextureStats(1024.f*1024.f);
 
 	gGL.getTexUnit(0)->activate();
 	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
-
-	if (mTexturep)
-	{
-		gGL.getTexUnit(0)->bind(mTexturep);
-	}
+	gGL.getTexUnit(0)->bind(mTexturep);
 	
 	LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
 	F32 tscale = 1.f/256.f;
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index ae62be0ad010d88b2c44793b2c3399ede10f3f97..d69c185a2b2be59c39838060bf4b22a5c45f70f4 100755
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1638,7 +1638,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 					do_xform = false;
 				}
 				
-				if (getVirtualSize() >= MIN_TEX_ANIM_SIZE)
+				if (getVirtualSize() >= MIN_TEX_ANIM_SIZE || isState(LLFace::RIGGED))
 				{ //don't override texture transform during tc bake
 					tex_mode = 0;
 				}
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp
index 29a3e6ac3a020bfa16283167ecd85eeef5ba897c..de96f75602bd06177252e40acd5033bed95f763c 100755
--- a/indra/newview/llfloateroutbox.cpp
+++ b/indra/newview/llfloateroutbox.cpp
@@ -95,7 +95,7 @@ class LLOutboxAddedObserver : public LLInventoryCategoryAddedObserver
 			
 			if (added_category_type == LLFolderType::FT_OUTBOX)
 			{
-				mOutboxFloater->setupOutbox(added_category->getUUID());
+				mOutboxFloater->initializeMarketPlace();
 			}
 		}
 	}
@@ -120,7 +120,6 @@ LLFloaterOutbox::LLFloaterOutbox(const LLSD& key)
 	, mInventoryText(NULL)
 	, mInventoryTitle(NULL)
 	, mOutboxId(LLUUID::null)
-	, mOutboxInventoryPanel(NULL)
 	, mOutboxItemCount(0)
 	, mOutboxTopLevelDropZone(NULL)
 	, mWindowShade(NULL)
@@ -157,9 +156,24 @@ BOOL LLFloaterOutbox::postBuild()
 
 	LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLFloaterOutbox::onFocusReceived, this));
 
+	// Observe category creation to catch outbox creation (moot if already existing)
+	mCategoryAddedObserver = new LLOutboxAddedObserver(this);
+	gInventory.addObserver(mCategoryAddedObserver);
+	
 	return TRUE;
 }
 
+void LLFloaterOutbox::cleanOutbox()
+{
+    // Note: we cannot delete the mOutboxInventoryPanel as that point
+    // as this is called through callback observers of the panel itself.
+    // Doing so would crash rapidly.
+	
+	// Invalidate the outbox data
+    mOutboxId.setNull();
+    mOutboxItemCount = 0;
+}
+
 void LLFloaterOutbox::onClose(bool app_quitting)
 {
 	if (mWindowShade)
@@ -173,33 +187,25 @@ void LLFloaterOutbox::onClose(bool app_quitting)
 void LLFloaterOutbox::onOpen(const LLSD& key)
 {
 	//
-	// Look for an outbox and set up the inventory API
+	// Initialize the Market Place or go update the outbox
 	//
-	
-	if (mOutboxId.isNull())
+	if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
 	{
-		const bool do_not_create_folder = false;
-		
-		const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder);
-		
-		if (outbox_id.isNull())
-		{
-			// Observe category creation to catch outbox creation
-			mCategoryAddedObserver = new LLOutboxAddedObserver(this);
-			gInventory.addObserver(mCategoryAddedObserver);
-		}
-		else
-		{
-			setupOutbox(outbox_id);
-		}
+		initializeMarketPlace();
+	}
+	else 
+	{
+		setupOutbox();
 	}
 	
+	//
+	// Update the floater view
+	//
 	updateView();
 	
 	//
 	// Trigger fetch of outbox contents
 	//
-	
 	fetchOutboxContents();
 }
 
@@ -216,14 +222,34 @@ void LLFloaterOutbox::fetchOutboxContents()
 	}
 }
 
-void LLFloaterOutbox::setupOutbox(const LLUUID& outboxId)
+void LLFloaterOutbox::setupOutbox()
 {
-	llassert(outboxId.notNull());
-	llassert(mOutboxId.isNull());
-	llassert(mCategoriesObserver == NULL);
-	
-	mOutboxId = outboxId;
-	
+	if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
+	{
+		// If we are *not* a merchant or we have no market place connection established yet, do nothing
+		return;
+	}
+		
+	// We are a merchant. Get the outbox, create it if needs be.
+	LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, true);
+	if (outbox_id.isNull())
+	{
+		// We should never get there unless the inventory fails badly
+		llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl;
+		return;
+	}
+    
+    // Consolidate Merchant Outbox
+    // We shouldn't have to do that but with a client/server system relying on a "well known folder" convention, things get messy and conventions get broken down eventually
+    gInventory.consolidateForType(outbox_id, LLFolderType::FT_OUTBOX);
+    
+    if (outbox_id == mOutboxId)
+    {
+        llwarns << "Inventory warning: Merchant outbox already set" << llendl;
+        return;
+    }
+    mOutboxId = outbox_id;
+
 	// No longer need to observe new category creation
 	if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver))
 	{
@@ -231,45 +257,55 @@ void LLFloaterOutbox::setupOutbox(const LLUUID& outboxId)
 		delete mCategoryAddedObserver;
 		mCategoryAddedObserver = NULL;
 	}
+	llassert(!mCategoryAddedObserver);
 	
-	// Create observer for outbox modifications
-	mCategoriesObserver = new LLInventoryCategoriesObserver();
-	gInventory.addObserver(mCategoriesObserver);
-	
-	mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this));
+	// Create observer for outbox modifications : clear the old one and create a new one
+	if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
+	{
+		gInventory.removeObserver(mCategoriesObserver);
+		delete mCategoriesObserver;
+	}
+    mCategoriesObserver = new LLInventoryCategoriesObserver();
+    gInventory.addObserver(mCategoriesObserver);
+    mCategoriesObserver->addCategory(mOutboxId, boost::bind(&LLFloaterOutbox::onOutboxChanged, this));
+	llassert(mCategoriesObserver);
 	
-	//
 	// Set up the outbox inventory view
-	//
-	
-	mOutboxInventoryPanel = 
-		LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml",
-														  mInventoryPlaceholder->getParent(),
-														  LLInventoryPanel::child_registry_t::instance());
-	
-	llassert(mOutboxInventoryPanel);
+	LLInventoryPanel* inventory_panel = mOutboxInventoryPanel.get();
+    if (inventory_panel)
+    {
+        delete inventory_panel;
+    }
+    inventory_panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance());
+    mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle();
+	llassert(mOutboxInventoryPanel.get() != NULL);
 	
 	// Reshape the inventory to the proper size
 	LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect();
-	mOutboxInventoryPanel->setShape(inventory_placeholder_rect);
+	inventory_panel->setShape(inventory_placeholder_rect);
 	
 	// Set the sort order newest to oldest
-
-	mOutboxInventoryPanel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);	
-	mOutboxInventoryPanel->getFilter().markDefault();
-	
+	inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME);	
+	inventory_panel->getFilter().markDefault();
+    
+	// Get the content of the outbox
 	fetchOutboxContents();
-	
+}
+
+void LLFloaterOutbox::initializeMarketPlace()
+{
 	//
 	// Initialize the marketplace import API
 	//
-	
 	LLMarketplaceInventoryImporter& importer = LLMarketplaceInventoryImporter::instance();
 	
-	importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2));
-	importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1));
-	importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2));
-	importer.initialize();
+    if (!importer.isInitialized())
+    {
+        importer.setInitializationErrorCallback(boost::bind(&LLFloaterOutbox::initializationReportError, this, _1, _2));
+        importer.setStatusChangedCallback(boost::bind(&LLFloaterOutbox::importStatusChanged, this, _1));
+        importer.setStatusReportCallback(boost::bind(&LLFloaterOutbox::importReportResults, this, _1, _2));
+        importer.initialize();
+    }
 }
 
 void LLFloaterOutbox::setStatusString(const std::string& statusString)
@@ -281,18 +317,26 @@ void LLFloaterOutbox::setStatusString(const std::string& statusString)
 
 void LLFloaterOutbox::updateFolderCount()
 {
-	S32 item_count = 0;
-
-	if (mOutboxId.notNull())
+	if (mOutboxInventoryPanel.get() && mOutboxId.notNull())
 	{
-		LLInventoryModel::cat_array_t * cats;
-		LLInventoryModel::item_array_t * items;
-		gInventory.getDirectDescendentsOf(mOutboxId, cats, items);
+        S32 item_count = 0;
 
-		item_count = cats->count() + items->count();
-	}
+        if (mOutboxId.notNull())
+        {
+            LLInventoryModel::cat_array_t * cats;
+            LLInventoryModel::item_array_t * items;
+            gInventory.getDirectDescendentsOf(mOutboxId, cats, items);
+
+            item_count = cats->count() + items->count();
+        }
 	
-	mOutboxItemCount = item_count;
+        mOutboxItemCount = item_count;
+    }
+    else
+    {
+        // If there's no outbox, the number of items in it should be set to 0 for consistency
+        mOutboxItemCount = 0;
+    }
 
 	if (!mImportBusy)
 	{
@@ -302,7 +346,7 @@ void LLFloaterOutbox::updateFolderCount()
 
 void LLFloaterOutbox::updateFolderCountStatus()
 {
-	if (mOutboxInventoryPanel)
+	if (mOutboxInventoryPanel.get() && mOutboxId.notNull())
 	{
 		switch (mOutboxItemCount)
 		{
@@ -327,18 +371,23 @@ void LLFloaterOutbox::updateFolderCountStatus()
 void LLFloaterOutbox::updateView()
 {
 	updateFolderCount();
+	LLInventoryPanel* panel = mOutboxInventoryPanel.get();
 
 	if (mOutboxItemCount > 0)
 	{
-		mOutboxInventoryPanel->setVisible(TRUE);
+		panel->setVisible(TRUE);
 		mInventoryPlaceholder->setVisible(FALSE);
+		mOutboxTopLevelDropZone->setVisible(TRUE);
 	}
 	else
 	{
-		if (mOutboxInventoryPanel)
+		if (panel)
 		{
-			mOutboxInventoryPanel->setVisible(FALSE);
+			panel->setVisible(FALSE);
 		}
+		
+		// Show the drop zone if there is an outbox folder
+		mOutboxTopLevelDropZone->setVisible(mOutboxId.notNull());
 
 		mInventoryPlaceholder->setVisible(TRUE);
 
@@ -347,19 +396,41 @@ void LLFloaterOutbox::updateView()
 		std::string outbox_tooltip;
 		
 		const LLSD& subs = getMarketplaceStringSubstitutions();
+		U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus();
 		
 		if (mOutboxId.notNull())
 		{
+            // Does the outbox needs recreation?
+            if ((mOutboxInventoryPanel.get() == NULL) || !gInventory.getCategory(mOutboxId))
+            {
+                setupOutbox();
+            }
+			// "Outbox is empty!" message strings
 			outbox_text = LLTrans::getString("InventoryOutboxNoItems", subs);
 			outbox_title = LLTrans::getString("InventoryOutboxNoItemsTitle");
 			outbox_tooltip = LLTrans::getString("InventoryOutboxNoItemsTooltip");
 		}
-		else
+		else if (mkt_status <= MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING)
+		{
+			// "Initializing!" message strings
+			outbox_text = LLTrans::getString("InventoryOutboxInitializing", subs);
+			outbox_title = LLTrans::getString("InventoryOutboxInitializingTitle");
+			outbox_tooltip = LLTrans::getString("InventoryOutboxInitializingTooltip");
+		}
+		else if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT)
 		{
+			// "Not a merchant!" message strings
 			outbox_text = LLTrans::getString("InventoryOutboxNotMerchant", subs);
 			outbox_title = LLTrans::getString("InventoryOutboxNotMerchantTitle");
 			outbox_tooltip = LLTrans::getString("InventoryOutboxNotMerchantTooltip");
 		}
+		else
+		{
+			// "Errors!" message strings
+			outbox_text = LLTrans::getString("InventoryOutboxError", subs);
+			outbox_title = LLTrans::getString("InventoryOutboxErrorTitle");
+			outbox_tooltip = LLTrans::getString("InventoryOutboxErrorTooltip");
+		}
 		
 		mInventoryText->setValue(outbox_text);
 		mInventoryTitle->setValue(outbox_title);
@@ -378,9 +449,10 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 										EAcceptance* accept,
 										std::string& tooltip_msg)
 {
-	if ((mOutboxInventoryPanel == NULL) ||
+	if ((mOutboxInventoryPanel.get() == NULL) ||
 		(mWindowShade && mWindowShade->isShown()) ||
-		LLMarketplaceInventoryImporter::getInstance()->isImportInProgress())
+		LLMarketplaceInventoryImporter::getInstance()->isImportInProgress() ||
+        mOutboxId.isNull())
 	{
 		return FALSE;
 	}
@@ -391,15 +463,16 @@ BOOL LLFloaterOutbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 	// Determine if the mouse is inside the inventory panel itself or just within the floater
 	bool pointInInventoryPanel = false;
 	bool pointInInventoryPanelChild = false;
-	LLFolderView* root_folder = mOutboxInventoryPanel->getRootFolder();
-	if (mOutboxInventoryPanel->getVisible())
+	LLInventoryPanel* panel = mOutboxInventoryPanel.get();
+	LLFolderView* root_folder = panel->getRootFolder();
+	if (panel->getVisible())
 	{
 		S32 inv_x, inv_y;
-		localPointToOtherView(x, y, &inv_x, &inv_y, mOutboxInventoryPanel);
+		localPointToOtherView(x, y, &inv_x, &inv_y, panel);
 
-		pointInInventoryPanel = mOutboxInventoryPanel->getRect().pointInRect(inv_x, inv_y);
+		pointInInventoryPanel = panel->getRect().pointInRect(inv_x, inv_y);
 
-		LLView * inventory_panel_child_at_point = mOutboxInventoryPanel->childFromPoint(inv_x, inv_y, true);
+		LLView * inventory_panel_child_at_point = panel->childFromPoint(inv_x, inv_y, true);
 		pointInInventoryPanelChild = (inventory_panel_child_at_point != root_folder);
 	}
 	
@@ -439,23 +512,26 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask)
 
 void LLFloaterOutbox::onImportButtonClicked()
 {
-	mOutboxInventoryPanel->clearSelection();
+    if (mOutboxInventoryPanel.get())
+    {
+        mOutboxInventoryPanel.get()->clearSelection();
+    }
 
 	mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport();
 }
 
 void LLFloaterOutbox::onOutboxChanged()
 {
-	llassert(!mOutboxId.isNull());
-	
-	//if (mOutboxInventoryPanel)
-	//{
-	//	mOutboxInventoryPanel->requestSort();
-	//}
-
-	fetchOutboxContents();
-
-	updateView();
+    LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId);
+	if (mOutboxId.notNull() && category)
+    {
+        fetchOutboxContents();
+        updateView();
+    }
+    else
+    {
+        cleanOutbox();
+    }
 }
 
 void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content)
@@ -486,6 +562,11 @@ void LLFloaterOutbox::importReportResults(U32 status, const LLSD& content)
 
 void LLFloaterOutbox::importStatusChanged(bool inProgress)
 {
+	if (mOutboxId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
+	{
+		setupOutbox();
+	}
+	
 	if (inProgress)
 	{
 		if (mImportBusy)
@@ -503,6 +584,7 @@ void LLFloaterOutbox::importStatusChanged(bool inProgress)
 	}
 	else
 	{
+		setStatusString("");
 		mImportBusy = false;
 		mImportButton->setEnabled(mOutboxItemCount > 0);
 		mInventoryImportInProgress->setVisible(false);
@@ -513,7 +595,7 @@ void LLFloaterOutbox::importStatusChanged(bool inProgress)
 
 void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content)
 {
-	if (status != MarketplaceErrorCodes::IMPORT_DONE)
+	if (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST)
 	{
 		char status_string[16];
 		sprintf(status_string, "%d", status);
diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h
index a91d8c113991be8e657b560791bc6289f164e819..40519c8fd2ea42c387ffb740b52f34e6eaa07ce4 100755
--- a/indra/newview/llfloateroutbox.h
+++ b/indra/newview/llfloateroutbox.h
@@ -54,7 +54,7 @@ class LLFloaterOutbox : public LLFloater
 	LLFloaterOutbox(const LLSD& key);
 	~LLFloaterOutbox();
 	
-	void setupOutbox(const LLUUID& outboxId);
+	void initializeMarketPlace();
 
 	// virtuals
 	BOOL postBuild();
@@ -70,6 +70,8 @@ class LLFloaterOutbox : public LLFloater
 	void onMouseLeave(S32 x, S32 y, MASK mask);
 
 protected:
+	void setupOutbox();
+    void cleanOutbox();
 	void fetchOutboxContents();
 
 	void importReportResults(U32 status, const LLSD& content);
@@ -104,7 +106,7 @@ class LLFloaterOutbox : public LLFloater
 	LLTextBox *		mInventoryTitle;
 	
 	LLUUID				mOutboxId;
-	LLInventoryPanel *	mOutboxInventoryPanel;
+	LLHandle<LLInventoryPanel> mOutboxInventoryPanel;
 	U32					mOutboxItemCount;
 	LLPanel *			mOutboxTopLevelDropZone;
 	
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index c28657dbcd3df4f290cb18f82f1e163461604205..aac3a41b9eedf1849a76f052b7d8832100138ca2 100755
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -232,16 +232,16 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
     return continue_filtering;
 }
 
-LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel()
-{
-	return &mInventoryViewModel;
-}
-
-
-const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const
-{
-	return &mInventoryViewModel;
-}
+//LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel()
+//{
+//	return &mInventoryViewModel;
+//}
+//
+//
+//const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const
+//{
+//	return &mInventoryViewModel;
+//}
 
 bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const
 {
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 935fe2b4d0e88c6c70c7e5f310ebaf7e4755f9e0..ed7fd3cd3473e0619af5c4c59e57b016777034be 100755
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -369,15 +369,74 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id)
 	mItemLock[cat_id] = false;
 }
 
+void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::EType type)
+{
+    // Make a list of folders that are not "main_id" and are of "type"
+    std::vector<LLUUID> folder_ids;
+    for (cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit)
+    {
+        LLViewerInventoryCategory* cat = cit->second;
+        if ((cat->getPreferredType() == type) && (cat->getUUID() != main_id))
+        {
+            folder_ids.push_back(cat->getUUID());
+        }
+    }
+
+    // Iterate through those folders
+	for (std::vector<LLUUID>::iterator folder_ids_it = folder_ids.begin(); folder_ids_it != folder_ids.end(); ++folder_ids_it)
+	{
+		LLUUID folder_id = (*folder_ids_it);
+        
+        // Get the content of this folder
+        cat_array_t* cats;
+        item_array_t* items;
+        getDirectDescendentsOf(folder_id, cats, items);
+        
+        // Move all items to the main folder
+        // Note : we get the list of UUIDs and iterate on them instead of iterating directly on item_array_t
+        // elements. This is because moving elements modify the maps and, consequently, invalidate iterators on them.
+        // This "gather and iterate" method is verbose but resilient.
+        std::vector<LLUUID> list_uuids;
+        for (item_array_t::const_iterator it = items->begin(); it != items->end(); ++it)
+        {
+            list_uuids.push_back((*it)->getUUID());
+        }
+        for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it)
+        {
+            LLViewerInventoryItem* item = getItem(*it);
+            changeItemParent(item, main_id, TRUE);
+        }
+
+        // Move all folders to the main folder
+        list_uuids.clear();
+        for (cat_array_t::const_iterator it = cats->begin(); it != cats->end(); ++it)
+        {
+            list_uuids.push_back((*it)->getUUID());
+        }
+        for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it)
+        {
+            LLViewerInventoryCategory* cat = getCategory(*it);
+            changeCategoryParent(cat, main_id, TRUE);
+        }
+        
+        // Purge the emptied folder
+        // Note: we'd like to use purgeObject() but it doesn't cleanly eliminate the folder
+        // which leads to issues further down the road when the folder is found again
+        //purgeObject(folder_id);
+        // We remove the folder and empty the trash instead which seems to work
+		removeCategory(folder_id);
+        gInventory.emptyFolderType("", LLFolderType::FT_TRASH);
+	}
+}
+
 // findCategoryUUIDForType() returns the uuid of the category that
 // specifies 'type' as what it defaults to containing. The category is
 // not necessarily only for that type. *NOTE: This will create a new
 // inventory category on the fly if one does not exist.
-const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder/*, 
+const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder/*,
 					  bool find_in_library*/)
 {
 	LLUUID rv = LLUUID::null;
-	
 	const LLUUID &root_id = /*(find_in_library) ? gInventory.getLibraryRootFolderID() :*/ gInventory.getRootFolderID();
 	if(LLFolderType::FT_ROOT_INVENTORY == preferred_type)
 	{
@@ -392,9 +451,9 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
 			S32 count = cats->count();
 			for(S32 i = 0; i < count; ++i)
 			{
-				if(cats->get(i)->getPreferredType() == preferred_type)
+				if (cats->get(i)->getPreferredType() == preferred_type)
 				{
-					rv = cats->get(i)->getUUID();
+                    rv = cats->get(i)->getUUID();
 					break;
 				}
 			}
@@ -587,7 +646,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
 	return id;
 }
 
-// Starting with the object specified, add it's descendents to the
+// Starting with the object specified, add its descendents to the
 // array provided, but do not add the inventory object specified by
 // id. There is no guaranteed order. Neither array will be erased
 // before adding objects to it. Do not store a copy of the pointers
@@ -1003,7 +1062,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
 		new_cat->copyViewerCategory(cat);
 		addCategory(new_cat);
 
-		// make sure this category is correctly referenced by it's parent.
+		// make sure this category is correctly referenced by its parent.
 		cat_array_t* cat_array;
 		cat_array = getUnlockedCatArray(cat->getParentUUID());
 		if(cat_array)
@@ -1209,12 +1268,6 @@ void LLInventoryModel::updateLinkedObjectsFromPurge(const LLUUID &baseobj_id)
 // folders, items, etc in a fairly efficient manner.
 void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 {
-	EHasChildren children = categoryHasChildren(id);
-	if(children == CHILDREN_NO)
-	{
-		llinfos << "Not purging descendents of " << id << llendl;
-		return;
-	}
 	LLPointer<LLViewerInventoryCategory> cat = getCategory(id);
 	if (cat.notNull())
 	{
@@ -1225,7 +1278,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 			<< " iterate and purge non hidden items" << llendl;
 			cat_array_t* categories;
 			item_array_t* items;
-			// Get the list of direct descendants in tha categoy passed as argument
+			// Get the list of direct descendants in that category passed as argument
 			getDirectDescendentsOf(id, categories, items);
 			std::vector<LLUUID> list_uuids;
 			// Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently)
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 8aac879a93780c1e9b27296b6589905b9684d938..544ca5e5dcc59e4f0b5673c36e06c611354bfcdb 100755
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -263,6 +263,11 @@ class LLInventoryModel
 	// Get the inventoryID or item that this item points to, else just return object_id
 	const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
 	LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const;
+    
+    // Copy content of all folders of type "type" into folder "id" and delete/purge the empty folders
+    // Note : This method has been designed for FT_OUTBOX (aka Merchant Outbox) but can be used for other categories
+    void consolidateForType(const LLUUID& id, LLFolderType::EType type);
+    
 private:
 	mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups	
 
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 9db175ec2e03b938e529c3926f29d8a7a76032a8..16427f2016dc2db13ce13ceeb9ec5745bd7fb780 100755
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -690,15 +690,24 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
 	if (!mCategoryMap.size())
 		return;
 
+	std::vector<LLUUID> deleted_categories_ids;
+
 	for (category_map_t::iterator iter = mCategoryMap.begin();
 		 iter != mCategoryMap.end();
 		 ++iter)
 	{
 		const LLUUID& cat_id = (*iter).first;
-
+		LLCategoryData& cat_data = (*iter).second;
+        
 		LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
 		if (!category)
+        {
+            llwarns << "Category : Category id = " << cat_id << " disappeared" << llendl;
+			cat_data.mCallback();
+            // Keep track of those deleted categories so we can remove them
+            deleted_categories_ids.push_back(cat_id);
 			continue;
+        }
 
 		const S32 version = category->getVersion();
 		const S32 expected_num_descendents = category->getDescendentCount();
@@ -726,8 +735,6 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
 		
 		const S32 current_num_known_descendents = cats->count() + items->count();
 
-		LLCategoryData& cat_data = (*iter).second;
-
 		bool cat_changed = false;
 
 		// If category version or descendents count has changed
@@ -757,6 +764,12 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
 		if (cat_changed)
 			cat_data.mCallback();
 	}
+    
+    // Remove deleted categories from the list
+ 	for (std::vector<LLUUID>::iterator deleted_id = deleted_categories_ids.begin(); deleted_id != deleted_categories_ids.end(); ++deleted_id)
+	{
+		removeCategory(*deleted_id);
+    }
 }
 
 bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb)
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index ed217718c1820c9c97d9248a84c1598a998bef17..afa2805f3a7ae25ce9033f7ff4b10842a5fe0b17 100755
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -137,7 +137,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
 	LLPanel(p),
 	mInventoryObserver(NULL),
 	mCompletionObserver(NULL),
-	mFolderRoot(NULL),
 	mScroller(NULL),
 	mSortOrderSetting(p.sort_order_setting),
 	mInventory(p.inventory),
@@ -197,6 +196,32 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
     return LLUICtrlFactory::create<LLFolderView>(p);
 }
 
+void LLInventoryPanel::clearFolderRoot()
+{
+	gIdleCallbacks.deleteFunction(idle, this);
+    gIdleCallbacks.deleteFunction(onIdle, this);
+    
+    if (mInventoryObserver)
+    {
+        mInventory->removeObserver(mInventoryObserver);
+        delete mInventoryObserver;
+        mInventoryObserver = NULL;
+    }
+    if (mCompletionObserver)
+    {
+        mInventory->removeObserver(mCompletionObserver);
+        delete mCompletionObserver;
+        mCompletionObserver = NULL;
+    }
+    
+    if (mScroller)
+    {
+        removeChild(mScroller);
+        delete mScroller;
+        mScroller = NULL;
+    }
+}
+
 void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 {
 	// save off copy of params
@@ -204,23 +229,23 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 	// Clear up the root view
 	// Note: This needs to be done *before* we build the new folder view 
 	LLUUID root_id = getRootFolderID();
-	if (mFolderRoot)
+	if (mFolderRoot.get())
 	{
 		removeItemID(root_id);
-		mFolderRoot->destroyView();
-		mFolderRoot = NULL;
+		mFolderRoot.get()->destroyView();
 	}
 
 	mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves
 	{
 		// Determine the root folder in case specified, and
 		// build the views starting with that folder.
-		mFolderRoot = createFolderRoot(root_id);
+        LLFolderView* folder_view = createFolderRoot(root_id);
+		mFolderRoot = folder_view->getHandle();
 	
-		addItemID(root_id, mFolderRoot);
+		addItemID(root_id, mFolderRoot.get());
 	}
 	mCommitCallbackRegistrar.popScope();
-	mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
+	mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar);
 	
 	// Scroller
 		LLRect scroller_view_rect = getRect();
@@ -229,10 +254,10 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 		scroller_params.rect(scroller_view_rect);
 		mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
 		addChild(mScroller);
-		mScroller->addChild(mFolderRoot);
-		mFolderRoot->setScrollContainer(mScroller);
-		mFolderRoot->setFollowsAll();
-		mFolderRoot->addChild(mFolderRoot->mStatusTextBox);
+		mScroller->addChild(mFolderRoot.get());
+		mFolderRoot.get()->setScrollContainer(mScroller);
+		mFolderRoot.get()->setFollowsAll();
+		mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox);
 
 	// Set up the callbacks from the inventory we're viewing, and then build everything.
 	mInventoryObserver = new LLInventoryPanelObserver(this);
@@ -260,8 +285,11 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 	}
 
 	// hide inbox
-	getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX));
-	getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_OUTBOX));
+	if (!gSavedSettings.getBOOL("InventoryOutboxMakeVisible"))
+	{
+		getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX));
+		getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_OUTBOX));
+	}
 
 	// set the filter for the empty folder if the debug setting is on
 	if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders"))
@@ -278,23 +306,13 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 
 LLInventoryPanel::~LLInventoryPanel()
 {
-	gIdleCallbacks.deleteFunction(idle, this);
-
 	U32 sort_order = getFolderViewModel()->getSorter().getSortOrder();
-		if (mSortOrderSetting != INHERIT_SORT_ORDER)
-		{
-			gSavedSettings.setU32(mSortOrderSetting, sort_order);
-		}
-
-	gIdleCallbacks.deleteFunction(onIdle, this);
-
-	// LLView destructor will take care of the sub-views.
-	mInventory->removeObserver(mInventoryObserver);
-	mInventory->removeObserver(mCompletionObserver);
-	delete mInventoryObserver;
-	delete mCompletionObserver;
-
-	mScroller = NULL;
+    if (mSortOrderSetting != INHERIT_SORT_ORDER)
+    {
+        gSavedSettings.setU32(mSortOrderSetting, sort_order);
+    }
+    
+    clearFolderRoot();
 }
 
 void LLInventoryPanel::draw()
@@ -361,9 +379,9 @@ void LLInventoryPanel::setSortOrder(U32 order)
 	if (order != getFolderViewModel()->getSorter().getSortOrder())
 	{
 		getFolderViewModel()->setSorter(sorter);
-		mFolderRoot->arrangeAll();
+		mFolderRoot.get()->arrangeAll();
 		// try to keep selection onscreen, even if it wasn't to start with
-		mFolderRoot->scrollToShowSelection();
+		mFolderRoot.get()->scrollToShowSelection();
 	}
 }
 
@@ -506,7 +524,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 				// Add the UI element for this item.
 				buildNewViews(item_id);
 				// Select any newly created object that has the auto rename at top of folder root set.
-				if(mFolderRoot->getRoot()->needsAutoRename())
+				if(mFolderRoot.get()->getRoot()->needsAutoRename())
 				{
 					setSelection(item_id, FALSE);
 				}
@@ -565,17 +583,11 @@ void LLInventoryPanel::modelChanged(U32 mask)
 	}
 }
 
-LLFolderView* LLInventoryPanel::getRootFolder() 
-{ 
-	return mFolderRoot; 
-}
-
 LLUUID LLInventoryPanel::getRootFolderID()
 {
-	if (mFolderRoot && mFolderRoot->getViewModelItem())
+	if (mFolderRoot.get() && mFolderRoot.get()->getViewModelItem())
 	{
-		return static_cast<LLFolderViewModelItemInventory*>(mFolderRoot->getViewModelItem())->getUUID();
-
+		return static_cast<LLFolderViewModelItemInventory*>(mFolderRoot.get()->getViewModelItem())->getUUID();
 	}
 	else
 	{
@@ -596,6 +608,9 @@ LLUUID LLInventoryPanel::getRootFolderID()
 			}
 			else if (preferred_type != LLFolderType::FT_NONE)
 			{
+                LLStringExplicit label(mParams.start_folder.name());
+                setLabel(label);
+                
 				root_id = gInventory.findCategoryUUIDForType(preferred_type, false);
 				if (root_id.isNull())
 				{
@@ -655,24 +670,33 @@ void LLInventoryPanel::idle(void* user_data)
 
 	}
 
-	panel->mFolderRoot->update();
-	// while dragging, update selection rendering to reflect single/multi drag status
-	if (LLToolDragAndDrop::getInstance()->hasMouseCapture())
-	{
-		EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept();
-		if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE)
-		{
-			panel->mFolderRoot->setShowSingleSelection(TRUE);
-		}
-		else
-		{
-			panel->mFolderRoot->setShowSingleSelection(FALSE);
-		}
-}
-	else
-	{
-		panel->mFolderRoot->setShowSingleSelection(FALSE);
-	}
+    // Take into account the fact that the root folder might be invalidated
+    if (panel->mFolderRoot.get())
+    {
+        panel->mFolderRoot.get()->update();
+        // while dragging, update selection rendering to reflect single/multi drag status
+        if (LLToolDragAndDrop::getInstance()->hasMouseCapture())
+        {
+            EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept();
+            if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE)
+            {
+                panel->mFolderRoot.get()->setShowSingleSelection(TRUE);
+            }
+            else
+            {
+                panel->mFolderRoot.get()->setShowSingleSelection(FALSE);
+            }
+        }
+        else
+        {
+            panel->mFolderRoot.get()->setShowSingleSelection(FALSE);
+        }
+    }
+    else
+    {
+        llwarns << "Inventory : Deleted folder root detected on panel" << llendl;
+        panel->clearFolderRoot();
+    }
 }
 
 
@@ -723,7 +747,7 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br
 	LLFolderViewFolder::Params params(mParams.folder);
 
 	params.name = bridge->getDisplayName();
-	params.root = mFolderRoot;
+	params.root = mFolderRoot.get();
 	params.listener = bridge;
 	params.tool_tip = params.name;
 
@@ -739,7 +763,7 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge
 	
 	params.name = bridge->getDisplayName();
 	params.creation_date = bridge->getCreationDate();
-	params.root = mFolderRoot;
+	params.root = mFolderRoot.get();
 	params.listener = bridge;
 	params.rect = LLRect (0, 0, 0, 0);
 	params.tool_tip = params.name;
@@ -780,7 +804,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
   																				LLInventoryType::IT_CATEGORY,
   																				this,
 																			&mInventoryViewModel,
-  																				mFolderRoot,
+  																				mFolderRoot.get(),
   																				objectp->getUUID());
   				if (new_listener)
   				{
@@ -796,7 +820,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
   																				item->getInventoryType(),
   																				this,
 																			&mInventoryViewModel,
-  																				mFolderRoot,
+  																				mFolderRoot.get(),
   																				item->getUUID(),
   																				item->getFlags());
  
@@ -853,7 +877,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
 void LLInventoryPanel::openStartFolderOrMyInventory()
 {
 	// Find My Inventory folder and open it up by name
-	for (LLView *child = mFolderRoot->getFirstChild(); child; child = mFolderRoot->findNextSibling(child))
+	for (LLView *child = mFolderRoot.get()->getFirstChild(); child; child = mFolderRoot.get()->findNextSibling(child))
 	{
 		LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child);
 		if (fchild
@@ -868,12 +892,12 @@ void LLInventoryPanel::openStartFolderOrMyInventory()
 
 void LLInventoryPanel::onItemsCompletion()
 {
-	if (mFolderRoot) mFolderRoot->updateMenu();
+	if (mFolderRoot.get()) mFolderRoot.get()->updateMenu();
 }
 
 void LLInventoryPanel::openSelected()
 {
-	LLFolderViewItem* folder_item = mFolderRoot->getCurSelectedItem();
+	LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
 	if(!folder_item) return;
 	LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
 	if(!bridge) return;
@@ -882,7 +906,7 @@ void LLInventoryPanel::openSelected()
 
 void LLInventoryPanel::unSelectAll()	
 { 
-	mFolderRoot->setSelection(NULL, FALSE, FALSE); 
+	mFolderRoot.get()->setSelection(NULL, FALSE, FALSE);
 }
 
 
@@ -920,14 +944,14 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 		// If folder view is empty the (x, y) point won't be in its rect
 		// so the handler must be called explicitly.
 		// but only if was not handled before. See EXT-6746.
-		if (!handled && !mFolderRoot->hasVisibleChildren())
+		if (!handled && !mFolderRoot.get()->hasVisibleChildren())
 		{
-			handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+			handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
 		}
 
 		if (handled)
 		{
-			mFolderRoot->setDragAndDropThisFrame();
+			mFolderRoot.get()->setDragAndDropThisFrame();
 		}
 	}
 
@@ -937,7 +961,7 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 void LLInventoryPanel::onFocusLost()
 {
 	// inventory no longer handles cut/copy/paste/delete
-	if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot)
+	if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot.get())
 	{
 		LLEditMenuHandler::gEditMenuHandler = NULL;
 	}
@@ -948,7 +972,7 @@ void LLInventoryPanel::onFocusLost()
 void LLInventoryPanel::onFocusReceived()
 {
 	// inventory now handles cut/copy/paste/delete
-	LLEditMenuHandler::gEditMenuHandler = mFolderRoot;
+	LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get();
 
 	LLPanel::onFocusReceived();
 }
@@ -959,7 +983,7 @@ bool LLInventoryPanel::addBadge(LLBadge * badge)
 
 	if (acceptsBadge())
 	{
-		badge_added = badge->addToView(mFolderRoot);
+		badge_added = badge->addToView(mFolderRoot.get());
 	}
 
 	return badge_added;
@@ -967,8 +991,8 @@ bool LLInventoryPanel::addBadge(LLBadge * badge)
 
 void LLInventoryPanel::openAllFolders()
 {
-	mFolderRoot->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
-	mFolderRoot->arrangeAll();
+	mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
+	mFolderRoot.get()->arrangeAll();
 }
 
 void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus)
@@ -984,9 +1008,9 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
 
 void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb) 
 { 
-	if (mFolderRoot) 
+	if (mFolderRoot.get())
 	{
-		mFolderRoot->setSelectCallback(cb);
+		mFolderRoot.get()->setSelectCallback(cb);
 	}
 }
 
@@ -1010,7 +1034,7 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it
 		}
 	}
 
-	LLFolderView* fv = getRootFolder();
+	LLFolderView* fv = mFolderRoot.get();
 	if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename
 	{
 		fv->setNeedsAutoRename(FALSE);
@@ -1029,7 +1053,7 @@ void LLInventoryPanel::doCreate(const LLSD& userdata)
 
 bool LLInventoryPanel::beginIMSession()
 {
-	std::set<LLFolderViewItem*> selected_items =   mFolderRoot->getSelectionList();
+	std::set<LLFolderViewItem*> selected_items =   mFolderRoot.get()->getSelectionList();
 
 	std::string name;
 
@@ -1123,7 +1147,7 @@ bool LLInventoryPanel::beginIMSession()
 bool LLInventoryPanel::attachObject(const LLSD& userdata)
 {
 	// Copy selected item UUIDs to a vector.
-	std::set<LLFolderViewItem*> selected_items = mFolderRoot->getSelectionList();
+	std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
 	uuid_vec_t items;
 	for (std::set<LLFolderViewItem*>::const_iterator set_iter = selected_items.begin();
 		 set_iter != selected_items.end(); 
@@ -1150,7 +1174,7 @@ BOOL LLInventoryPanel::getSinceLogoff()
 void LLInventoryPanel::dumpSelectionInformation(void* user_data)
 {
 	LLInventoryPanel* iv = (LLInventoryPanel*)user_data;
-	iv->mFolderRoot->dumpSelectionInformation();
+	iv->mFolderRoot.get()->dumpSelectionInformation();
 }
 
 BOOL is_inventorysp_active()
@@ -1352,7 +1376,7 @@ void LLInventoryPanel::updateSelection()
 
 void LLInventoryPanel::doToSelected(const LLSD& userdata)
 {
-	LLInventoryAction::doToSelected(mInventory, mFolderRoot, userdata.asString());
+	LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), userdata.asString());
 
 	return;
 }
@@ -1366,7 +1390,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask )
 		// Open selected items if enter key hit on the inventory panel
 		if (mask == MASK_NONE)
 		{
-			LLInventoryAction::doToSelected(mInventory, mFolderRoot, "open");
+			LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open");
 			handled = TRUE;
 		}
 		break;
@@ -1376,7 +1400,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask )
 		// Note: on Mac laptop keyboards, backspace and delete are one and the same
 		if (isSelectionRemovable() && (mask == MASK_NONE))
 		{
-			LLInventoryAction::doToSelected(mInventory, mFolderRoot, "delete");
+			LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete");
 			handled = TRUE;
 		}
 		break;
@@ -1387,9 +1411,9 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask )
 bool LLInventoryPanel::isSelectionRemovable()
 {
 	bool can_delete = false;
-	if (mFolderRoot)
+	if (mFolderRoot.get())
 	{
-		std::set<LLFolderViewItem*> selection_set = mFolderRoot->getSelectionList();
+		std::set<LLFolderViewItem*> selection_set = mFolderRoot.get()->getSelectionList();
 		if (!selection_set.empty()) 
 		{
 			can_delete = true;
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 00a90325ad0161417bca2ac914bd69d2875cd2e7..c0ce5136940332353832a10bd971c784ec9b72ae 100755
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -181,7 +181,7 @@ class LLInventoryPanel : public LLPanel
 	LLInventoryFilter::EFolderShow getShowFolderState();
 	// This method is called when something has changed about the inventory.
 	void modelChanged(U32 mask);
-	LLFolderView* getRootFolder();
+	LLFolderView* getRootFolder() { return mFolderRoot.get(); }
 	LLUUID getRootFolderID();
 	LLScrollContainer* getScrollableContainer() { return mScroller; }
 	
@@ -217,8 +217,11 @@ class LLInventoryPanel : public LLPanel
 	void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus);
 	void updateSelection();
 
-	LLFolderViewModelInventory* getFolderViewModel();
-	const LLFolderViewModelInventory* getFolderViewModel() const;
+	LLFolderViewModelInventory* getFolderViewModel() { return &mInventoryViewModel; }
+	const LLFolderViewModelInventory* getFolderViewModel() const { return &mInventoryViewModel; }
+    
+    // Clean up stuff when the folder root gets deleted
+    void clearFolderRoot();
 
 protected:
 	void openStartFolderOrMyInventory(); // open the first level of inventory
@@ -233,7 +236,7 @@ class LLInventoryPanel : public LLPanel
 	bool 						mShowItemLinkOverlays; // Shows link graphic over inventory item icons
 	bool						mShowEmptyMessage;
 
-	LLFolderView*				mFolderRoot;
+	LLHandle<LLFolderView>      mFolderRoot;
 	LLScrollContainer*			mScroller;
 
 	LLFolderViewModelInventory	mInventoryViewModel;
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 0b009b68f74ae87e4854a767b8cf2ef9aecbd60f..05c9d768100d83bd814fbb7bbead608036e7e2bc 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -30,6 +30,7 @@
 
 #include "llagent.h"
 #include "llhttpclient.h"
+#include "llsdserialize.h"
 #include "lltimer.h"
 #include "lltrans.h"
 #include "llviewercontrol.h"
@@ -135,19 +136,25 @@ namespace LLMarketplaceImport
 				llinfos << " SLM POST status: " << status << llendl;
 				llinfos << " SLM POST reason: " << reason << llendl;
 				llinfos << " SLM POST content: " << content.asString() << llendl;
-
 				llinfos << " SLM POST timer: " << slmPostTimer.getElapsedTimeF32() << llendl;
 			}
 
-			if ((status == MarketplaceErrorCodes::IMPORT_REDIRECT) ||
-				(status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
-				(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
+			// MAINT-2301 : we determined we can safely ignore that error in that context
+			if (status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT)
 			{
 				if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
 				{
-					llinfos << " SLM POST clearing marketplace cookie due to authentication failure or timeout" << llendl;
+					llinfos << " SLM POST : Ignoring time out status and treating it as success" << llendl;
+				}
+				status = MarketplaceErrorCodes::IMPORT_DONE;
+			}
+			
+			if (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST)
+			{
+				if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
+				{
+					llinfos << " SLM POST clearing marketplace cookie due to client or server error" << llendl;
 				}
-
 				sMarketplaceCookie.clear();
 			}
 
@@ -182,20 +189,25 @@ namespace LLMarketplaceImport
 				llinfos << " SLM GET status: " << status << llendl;
 				llinfos << " SLM GET reason: " << reason << llendl;
 				llinfos << " SLM GET content: " << content.asString() << llendl;
-
 				llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl;
 			}
 			
-			if ((status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
-				(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
+            // MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS : Happens when trying to import objects with wrong permissions
+            // ACME-1221 : Do not clear the cookie on IMPORT_NOT_FOUND : Happens for newly created Merchant accounts that are initally empty
+			if ((status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST) &&
+                (status != MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS) &&
+                (status != MarketplaceErrorCodes::IMPORT_NOT_FOUND))
 			{
 				if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
 				{
-					llinfos << " SLM GET clearing marketplace cookie due to authentication failure or timeout" << llendl;
+					llinfos << " SLM GET clearing marketplace cookie due to client or server error" << llendl;
 				}
-
 				sMarketplaceCookie.clear();
 			}
+            else if (gSavedSettings.getBOOL("InventoryOutboxLogging") && (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST))
+            {
+                llinfos << " SLM GET : Got error status = " << status << ", but marketplace cookie not cleared." << llendl;
+            }
 
 			sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING);
 			sImportGetPending = false;
@@ -256,7 +268,12 @@ namespace LLMarketplaceImport
 		
 		if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
 		{
-			llinfos << " SLM GET: " << url << llendl;
+            llinfos << " SLM GET: establishMarketplaceSessionCookie, LLHTTPClient::get, url = " << url << llendl;
+            LLSD headers = LLViewerMedia::getHeaders();
+            std::stringstream str;
+            LLSDSerialize::toPrettyXML(headers, str);
+            llinfos << " SLM GET: headers " << llendl;
+            llinfos << str.str() << llendl;
 		}
 
 		slmGetTimer.start();
@@ -287,7 +304,11 @@ namespace LLMarketplaceImport
 		
 		if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
 		{
-			llinfos << " SLM GET: " << url << llendl;
+            llinfos << " SLM GET: pollStatus, LLHTTPClient::get, url = " << url << llendl;
+            std::stringstream str;
+            LLSDSerialize::toPrettyXML(headers, str);
+            llinfos << " SLM GET: headers " << llendl;
+            llinfos << str.str() << llendl;
 		}
 
 		slmGetTimer.start();
@@ -321,11 +342,15 @@ namespace LLMarketplaceImport
 		
 		if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
 		{
-			llinfos << " SLM POST: " << url << llendl;
+            llinfos << " SLM POST: triggerImport, LLHTTPClient::post, url = " << url << llendl;
+            std::stringstream str;
+            LLSDSerialize::toPrettyXML(headers, str);
+            llinfos << " SLM POST: headers " << llendl;
+            llinfos << str.str() << llendl;
 		}
 
 		slmPostTimer.start();
-		LLHTTPClient::post(url, LLSD(), new LLImportPostResponder(), headers);
+        LLHTTPClient::post(url, LLSD(), new LLImportPostResponder(), headers);
 		
 		return true;
 	}
@@ -356,6 +381,7 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
 	: mAutoTriggerImport(false)
 	, mImportInProgress(false)
 	, mInitialized(false)
+	, mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
 	, mErrorInitSignal(NULL)
 	, mStatusChangedSignal(NULL)
 	, mStatusReportSignal(NULL)
@@ -394,20 +420,27 @@ boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallb
 
 void LLMarketplaceInventoryImporter::initialize()
 {
-	llassert(!mInitialized);
+    if (mInitialized)
+    {
+        return;
+    }
 
 	if (!LLMarketplaceImport::hasSessionCookie())
 	{
+		mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
 		LLMarketplaceImport::establishMarketplaceSessionCookie();
 	}
+	else
+	{
+		mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
+	}
 }
 
 void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
 {
 	mInitialized = false;
-
+	mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED;
 	initialize();
-
 	mAutoTriggerImport = true;
 }
 
@@ -459,17 +492,30 @@ void LLMarketplaceInventoryImporter::updateImport()
 				
 				if (mInitialized)
 				{
+					mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
 					// Follow up with auto trigger of import
 					if (mAutoTriggerImport)
 					{
 						mAutoTriggerImport = false;
-
 						mImportInProgress = triggerImport();
 					}
 				}
-				else if (mErrorInitSignal)
+				else
 				{
-					(*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
+					U32 status = LLMarketplaceImport::getResultStatus();
+					if ((status == MarketplaceErrorCodes::IMPORT_FORBIDDEN) ||
+						(status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR))
+					{
+						mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT;
+					}
+					else 
+					{
+						mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE;
+					}
+					if (mErrorInitSignal && (mMarketPlaceStatus == MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE))
+					{
+						(*mErrorInitSignal)(LLMarketplaceImport::getResultStatus(), LLMarketplaceImport::getResults());
+					}
 				}
 			}
 		}
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index 4b8f7a1ac77676b1422fea28d7f1e5cc24aa9d19..abe60890a30c6eda48e884fa53543f8f07ecd57b 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -47,10 +47,27 @@ namespace MarketplaceErrorCodes
 		IMPORT_DONE = 200,
 		IMPORT_PROCESSING = 202,
 		IMPORT_REDIRECT = 302,
+		IMPORT_BAD_REQUEST = 400,
 		IMPORT_AUTHENTICATION_ERROR = 401,
+		IMPORT_FORBIDDEN = 403,
+		IMPORT_NOT_FOUND = 404,
 		IMPORT_DONE_WITH_ERRORS = 409,
 		IMPORT_JOB_FAILED = 410,
 		IMPORT_JOB_TIMEOUT = 499,
+		IMPORT_SERVER_SITE_DOWN = 500,
+		IMPORT_SERVER_API_DISABLED = 503,
+	};
+}
+
+namespace MarketplaceStatusCodes
+{
+	enum sCode
+	{
+		MARKET_PLACE_NOT_INITIALIZED = 0,
+		MARKET_PLACE_INITIALIZING = 1,
+		MARKET_PLACE_CONNECTION_FAILURE = 2,
+		MARKET_PLACE_MERCHANT = 3,
+		MARKET_PLACE_NOT_MERCHANT = 4,
 	};
 }
 
@@ -73,6 +90,8 @@ class LLMarketplaceInventoryImporter
 	void initialize();
 	bool triggerImport();
 	bool isImportInProgress() const { return mImportInProgress; }
+	bool isInitialized() const { return mInitialized; }
+	U32 getMarketPlaceStatus() const { return mMarketPlaceStatus; }
 	
 protected:
 	void reinitializeAndTriggerImport();
@@ -82,6 +101,7 @@ class LLMarketplaceInventoryImporter
 	bool mAutoTriggerImport;
 	bool mImportInProgress;
 	bool mInitialized;
+	U32  mMarketPlaceStatus;
 	
 	status_report_signal_t *	mErrorInitSignal;
 	status_changed_signal_t *	mStatusChangedSignal;
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 193e2ea678a5ba71d1eedebf078f8e6b2fe7e09f..08b5eaedbbe9d5d899324b90a8ab3fc00de98081 100755
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -798,10 +798,7 @@ void LLNetMap::createObjectImage()
 	{
 		mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
 		U8* data = mObjectRawImagep->getData();
-		if (data)
-		{
-			memset( data, 0, img_size * img_size * 4 );
-		}
+		memset( data, 0, img_size * img_size * 4 );
 		mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE);
 	}
 	setScale(mScale);
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp
index adfb2dee86da79831649193ae48cc22b1fd9ba3a..da938712d7ad07bfaf572780f060d5c76faf174e 100755
--- a/indra/newview/llpanelmarketplaceinboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp
@@ -69,7 +69,7 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge
 	LLInboxFolderViewFolder::Params params;
 	
 	params.name = bridge->getDisplayName();
-	params.root = mFolderRoot;
+	params.root = mFolderRoot.get();
 	params.listener = bridge;
 	params.tool_tip = params.name;
 	params.font_color = item_color;
@@ -86,7 +86,7 @@ LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * b
 
 	params.name = bridge->getDisplayName();
 	params.creation_date = bridge->getCreationDate();
-	params.root = mFolderRoot;
+	params.root = mFolderRoot.get();
 	params.listener = bridge;
 	params.rect = LLRect (0, 0, 0, 0);
 	params.tool_tip = params.name;
diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
index 4c2213c1982087b4b28394dfac133435ec238e5c..5eadd65884c31e0ad92401b7be7bc86b644629c4 100755
--- a/indra/newview/llplacesinventorypanel.cpp
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -91,17 +91,17 @@ LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id )
 void LLPlacesInventoryPanel::saveFolderState()
 {
 	mSavedFolderState->setApply(FALSE);
-	mFolderRoot->applyFunctorRecursively(*mSavedFolderState);
+	mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState);
 }
 
 // re-open folders which state was saved
 void LLPlacesInventoryPanel::restoreFolderState()
 {
 	mSavedFolderState->setApply(TRUE);
-	mFolderRoot->applyFunctorRecursively(*mSavedFolderState);
+	mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState);
 	LLOpenFoldersWithSelection opener;
-	mFolderRoot->applyFunctorRecursively(opener);
-	mFolderRoot->scrollToShowSelection();
+	mFolderRoot.get()->applyFunctorRecursively(opener);
+	mFolderRoot.get()->scrollToShowSelection();
 }
 
 S32	LLPlacesInventoryPanel::notify(const LLSD& info) 
@@ -111,11 +111,11 @@ S32	LLPlacesInventoryPanel::notify(const LLSD& info)
 		std::string str_action = info["action"];
 		if(str_action == "select_first")
 		{
-			return mFolderRoot->notify(info);
+			return mFolderRoot.get()->notify(info);
 		}
 		else if(str_action == "select_last")
 		{
-			return mFolderRoot->notify(info);
+			return mFolderRoot.get()->notify(info);
 		}
 	}
 	return 0;
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 1ce691f696b47aba3eeb6bfca8a4411b478425b8..d7ea8d572c4fdba7daab43c7b1a5adb30c94d5ab 100755
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -119,7 +119,6 @@ class LLInboxAddedObserver : public LLInventoryCategoryAddedObserver
 LLSidepanelInventory::LLSidepanelInventory()
 	: LLPanel()
 	, mItemPanel(NULL)
-	, mInventoryPanelInbox(NULL)
 	, mPanelMainInventory(NULL)
 	, mInboxEnabled(false)
 	, mCategoriesObserver(NULL)
@@ -299,7 +298,7 @@ void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID)
 	// (this can happen multiple times on the initial session that creates the inbox)
 	//
 
-	if (mInventoryPanelInbox != NULL)
+	if (mInventoryPanelInbox.get() != NULL)
 	{
 		return;
 	}
@@ -333,7 +332,8 @@ void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID)
 	//
 
 	LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
-	mInventoryPanelInbox = inbox->setupInventoryPanel();
+    LLInventoryPanel* inventory_panel = inbox->setupInventoryPanel();
+	mInventoryPanelInbox = inventory_panel->getInventoryPanelHandle();
 }
 
 void LLSidepanelInventory::enableInbox(bool enabled)
@@ -461,9 +461,9 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action)
 	LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
 	if (!current_item)
 	{
-		if (mInventoryPanelInbox)
+		if (mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
 		{
-			current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem();
+			current_item = mInventoryPanelInbox.get()->getRootFolder()->getCurSelectedItem();
 		}
 
 		if (!current_item)
@@ -614,10 +614,10 @@ void LLSidepanelInventory::updateVerbs()
 
 bool LLSidepanelInventory::canShare()
 {
-	LLInventoryPanel* inbox = mInventoryPanelInbox;
+	LLInventoryPanel* inbox = mInventoryPanelInbox.get();
 
 	// Avoid flicker in the Recent tab while inventory is being loaded.
-	if ( (!inbox || inbox->getRootFolder()->getSelectionList().empty())
+	if ( (!inbox || !inbox->getRootFolder() || inbox->getRootFolder()->getSelectionList().empty())
 		&& (mPanelMainInventory && !mPanelMainInventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
 	{
 		return false;
@@ -652,9 +652,9 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem()
 	
 	if (!current_item)
 	{
-		if (mInventoryPanelInbox)
+		if (mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
 		{
-			current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem();
+			current_item = mInventoryPanelInbox.get()->getRootFolder()->getCurSelectedItem();
 		}
 
 		if (!current_item)
@@ -671,12 +671,12 @@ U32 LLSidepanelInventory::getSelectedCount()
 {
 	int count = 0;
 
-	std::set<LLFolderViewItem*> selection_list =    mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList();
+	std::set<LLFolderViewItem*> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList();
 	count += selection_list.size();
 
-	if ((count == 0) && mInboxEnabled && (mInventoryPanelInbox != NULL))
+	if ((count == 0) && mInboxEnabled && mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
 	{
-		selection_list = mInventoryPanelInbox->getRootFolder()->getSelectionList();
+		selection_list = mInventoryPanelInbox.get()->getRootFolder()->getSelectionList();
 
 		count += selection_list.size();
 	}
@@ -714,9 +714,9 @@ void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox)
 		}
 	}
 	
-	if (clearInbox && mInboxEnabled && (mInventoryPanelInbox != NULL))
+	if (clearInbox && mInboxEnabled && mInventoryPanelInbox.get())
 	{
-		mInventoryPanelInbox->getRootFolder()->clearSelection();
+		mInventoryPanelInbox.get()->getRootFolder()->clearSelection();
 	}
 	
 	updateVerbs();
@@ -726,9 +726,9 @@ std::set<LLFolderViewItem*> LLSidepanelInventory::getInboxSelectionList()
 {
 	std::set<LLFolderViewItem*> inventory_selected_uuids;
 	
-	if (mInboxEnabled && (mInventoryPanelInbox != NULL))
+	if (mInboxEnabled && mInventoryPanelInbox.get() && mInventoryPanelInbox.get()->getRootFolder())
 	{
-		inventory_selected_uuids = mInventoryPanelInbox->getRootFolder()->getSelectionList();
+		inventory_selected_uuids = mInventoryPanelInbox.get()->getRootFolder()->getSelectionList();
 	}
 	
 	return inventory_selected_uuids;
diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h
index e8b2808d4fd7e00538314726c2af239f3cc6d192..17a3098db9c66431bc61d0ea5c07ea1a127a6a88 100755
--- a/indra/newview/llsidepanelinventory.h
+++ b/indra/newview/llsidepanelinventory.h
@@ -57,7 +57,7 @@ class LLSidepanelInventory : public LLPanel
 	/*virtual*/ void onOpen(const LLSD& key);
 
 	LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any.
-	LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox; }
+	LLInventoryPanel* getInboxPanel() const { return mInventoryPanelInbox.get(); }
 
 	LLPanelMainInventory* getMainInventoryPanel() const { return mPanelMainInventory; }
 	BOOL isMainInventoryPanelActive() const;
@@ -99,7 +99,7 @@ class LLSidepanelInventory : public LLPanel
 	//
 private:
 	LLPanel*					mInventoryPanel; // Main inventory view
-	LLInventoryPanel*			mInventoryPanelInbox;
+	LLHandle<LLInventoryPanel>	mInventoryPanelInbox;
 	LLSidepanelItemInfo*		mItemPanel; // Individual item view
 	LLSidepanelTaskInfo*		mTaskPanel; // Individual in-world object view
 	LLPanelMainInventory*		mPanelMainInventory;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 6d2ae7c3e10dba158020bce071f90e2244d6b4d6..3427fc10fcc8d9ed81acdb8ef33040329fa6fbe9 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2684,7 +2684,7 @@ void init_start_screen(S32 location_id)
 		}
 	}
 
-	if(gStartTexture && gStartTexture.isNull())
+	if(gStartTexture.isNull())
 	{
 		gStartTexture = LLViewerTexture::sBlackImagep ;
 		gStartImageWidth = gStartTexture->getWidth() ;
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index f1b27279e3a097b3df2bfda85a9fe8e5a93b1173..93c7f54101372724aea6ef9e381aecca56354d08 100755
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -233,12 +233,6 @@ void LLSurface::createSTexture()
 		// GL NOT ACTIVE HERE
 		LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3);
 		U8 *default_texture = raw->getData();
-
-		if (!default_texture)
-		{
-			return;
-		}
-
 		for (S32 i = 0; i < sTextureSize; i++)
 		{
 			for (S32 j = 0; j < sTextureSize; j++)
@@ -263,12 +257,6 @@ void LLSurface::createWaterTexture()
 		// Create the water texture
 		LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize/2, sTextureSize/2, 4);
 		U8 *default_texture = raw->getData();
-
-		if (!default_texture)
-		{
-			return;
-		}
-
 		for (S32 i = 0; i < sTextureSize/2; i++)
 		{
 			for (S32 j = 0; j < sTextureSize/2; j++)
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 8d9d2421da7a732a287ea0a59c5bfe308f64d509..5bc2e971ebee8be581ba3049511b3334db38a330 100755
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1937,7 +1937,7 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis
 	memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32));
 
 	S32 copy_size = w * h * c;
-	if(copy_size > 0 && raw->getData()) //valid
+	if(copy_size > 0) //valid
 	{
 		copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
 		memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size);
diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp
index a179b61cffc78c7c61ade5cd39935c2ffa079588..991f6b40e64dccd3d626e4cf1e38d4aed09eb7dc 100644
--- a/indra/newview/llviewerfoldertype.cpp
+++ b/indra/newview/llviewerfoldertype.cpp
@@ -30,6 +30,9 @@
 #include "lldictionary.h"
 #include "llmemory.h"
 #include "llvisualparam.h"
+#include "llcontrol.h"
+
+extern LLControlGroup gSavedSettings;
 
 static const std::string empty_string;
 
@@ -132,8 +135,9 @@ LLViewerFolderDictionary::LLViewerFolderDictionary()
 	addEntry(LLFolderType::FT_MY_OUTFITS, 			new ViewerFolderEntry("My Outfits",				"Inv_SysOpen",			"Inv_SysClosed",		TRUE,      true));
 	addEntry(LLFolderType::FT_MESH, 				new ViewerFolderEntry("Meshes",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
 	
-	addEntry(LLFolderType::FT_INBOX, 				new ViewerFolderEntry("Inbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
-	addEntry(LLFolderType::FT_OUTBOX, 				new ViewerFolderEntry("Outbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
+	bool boxes_invisible = !gSavedSettings.getBOOL("InventoryOutboxMakeVisible");
+	addEntry(LLFolderType::FT_INBOX, 				new ViewerFolderEntry("Inbox",					"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     boxes_invisible));
+	addEntry(LLFolderType::FT_OUTBOX, 				new ViewerFolderEntry("Merchant Outbox",		"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     boxes_invisible));
 
 	addEntry(LLFolderType::FT_BASIC_ROOT, 			new ViewerFolderEntry("Basic Root",				"Inv_SysOpen",			"Inv_SysClosed",		FALSE,     true));
 		 
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index fad77bce255ed05b2f6a6ea05afc905338996e68..a1c12c5cd6ead81bfc950b2fc4ff811ffd13933d 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -76,13 +76,10 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_
 	//
 	// Create the base texture.
 	U8 *raw = mImageRaw->getData();
-	if (raw)
+	const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
+	for (S32 i = 0; i < COUNT; i++)
 	{
-		const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
-		for (S32 i = 0; i < COUNT; i++)
-		{
-			raw[i] = 0;
-		}
+		raw[i] = 0;
 	}
 	//mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
 
@@ -383,13 +380,10 @@ void LLViewerParcelOverlay::updateOverlayTexture()
 			break;
 		}
 
-		if (raw)
-		{
-			raw[pixel_index + 0] = (U8)r;
-			raw[pixel_index + 1] = (U8)g;
-			raw[pixel_index + 2] = (U8)b;
-			raw[pixel_index + 3] = (U8)a;
-		}
+		raw[pixel_index + 0] = (U8)r;
+		raw[pixel_index + 1] = (U8)g;
+		raw[pixel_index + 2] = (U8)b;
+		raw[pixel_index + 3] = (U8)a;
 
 		pixel_index += OVERLAY_IMG_COMPONENTS;
 	}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 6364eee3ec8a32c54f6b42a1e559dbcacf1c9220..3da6d33d7281990b74a99608523aac72dc9d8704 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -337,11 +337,6 @@ void LLViewerTextureManager::init()
 	const S32 dim = 128;
 	LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
 	U8* data = image_raw->getData();
-
-	if (!data)
-	{
-		return;
-	}
 	
 	memset(data, 0, dim * dim * 3) ;
 	LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ;
@@ -378,12 +373,8 @@ void LLViewerTextureManager::init()
 #else
  	LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
 #endif
-
-	if (LLViewerFetchedTexture::sDefaultImagep)
-	{
-		LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
-		LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
-	}
+	LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
+	LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
 
  	LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
 	LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ;
@@ -699,7 +690,7 @@ bool LLViewerTexture::bindDefaultImage(S32 stage)
 	if (stage < 0) return false;
 
 	bool res = true;
-	if (LLViewerFetchedTexture::sDefaultImagep && LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
+	if (LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
 	{
 		// use default if we've got it
 		res = gGL.getTexUnit(stage)->bind(LLViewerFetchedTexture::sDefaultImagep);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index ca004962d57f60a61f0a74d62645a54249705c5d..082a85e2171ce436477e2dbe6560492f612bd768 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -818,8 +818,7 @@ void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index)
 		return;
 	}
 
-	LLViewerTexture * tx = getTEImage(te);
-	if (!tx || tx->getID() == image->getID())
+	if (getTEImage(te)->getID() == image->getID())
 	{
 		return;
 	}
@@ -1699,7 +1698,6 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index)
 		const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
 		if (type >= 0
 			&& local_tex_obj->getID() != IMG_DEFAULT_AVATAR
-			&& image
 			&& !image->isMissingAsset())
 		{
 			return image->getDiscardLevel();
@@ -2038,10 +2036,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const
 /*static*/
 void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
 {
-	if (gAgentAvatarp)
-	{
-		gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
-	}
+	gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
 }
 
 void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 467152881e3059d7e3a87a26364a44d6f1016ab3..93f0e50336e90e0da161eb85f4a3411502cfd567 100755
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -257,21 +257,18 @@ LLSkyTex::~LLSkyTex()
 void LLSkyTex::initEmpty(const S32 tex)
 {
 	U8* data = mImageRaw[tex]->getData();
-	if (data)
+	for (S32 i = 0; i < sResolution; ++i)
 	{
-		for (S32 i = 0; i < sResolution; ++i)
+		for (S32 j = 0; j < sResolution; ++j)
 		{
-			for (S32 j = 0; j < sResolution; ++j)
-			{
-				const S32 basic_offset = (i * sResolution + j);
-				S32 offset = basic_offset * sComponents;
-				data[offset] = 0;
-				data[offset+1] = 0;
-				data[offset+2] = 0;
-				data[offset+3] = 255;
-
-				mSkyData[basic_offset].setToBlack();
-			}
+			const S32 basic_offset = (i * sResolution + j);
+			S32 offset = basic_offset * sComponents;
+			data[offset] = 0;
+			data[offset+1] = 0;
+			data[offset+2] = 0;
+			data[offset+3] = 255;
+
+			mSkyData[basic_offset].setToBlack();
 		}
 	}
 
@@ -282,21 +279,17 @@ void LLSkyTex::create(const F32 brightness)
 {
 	/// Brightness ignored for now.
 	U8* data = mImageRaw[sCurrent]->getData();
-	if (data)
+	for (S32 i = 0; i < sResolution; ++i)
 	{
-		for (S32 i = 0; i < sResolution; ++i)
+		for (S32 j = 0; j < sResolution; ++j)
 		{
-			for (S32 j = 0; j < sResolution; ++j)
-			{
-				const S32 basic_offset = (i * sResolution + j);
-				S32 offset = basic_offset * sComponents;
-				U32* pix = (U32*)(data + offset);
-				LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
-				*pix = temp.mAll;
-			}
+			const S32 basic_offset = (i * sResolution + j);
+			S32 offset = basic_offset * sComponents;
+			U32* pix = (U32*)(data + offset);
+			LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
+			*pix = temp.mAll;
 		}
 	}
-
 	createGLImage(sCurrent);
 }
 
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 27256af97aaf142815c0ca03065a9a050679949e..85614f397c02a3ee269bed82713f6b59378896df 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -101,21 +101,15 @@ LLWorld::LLWorld() :
 
 	LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,4);
 	U8 *default_texture = raw->getData();
+	*(default_texture++) = MAX_WATER_COLOR.mV[0];
+	*(default_texture++) = MAX_WATER_COLOR.mV[1];
+	*(default_texture++) = MAX_WATER_COLOR.mV[2];
+	*(default_texture++) = MAX_WATER_COLOR.mV[3];
+	
+	mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+	gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
+	mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
 
-	if (default_texture)
-	{
-		*(default_texture++) = MAX_WATER_COLOR.mV[0];
-		*(default_texture++) = MAX_WATER_COLOR.mV[1];
-		*(default_texture++) = MAX_WATER_COLOR.mV[2];
-		*(default_texture++) = MAX_WATER_COLOR.mV[3];
-	}
-
-	if (mDefaultWaterTexturep)
-	{
-		mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
-		gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
-		mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
-	}
 }
 
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 725fe1ffdd5891529d93a43ba7a3a1f8ce8bc6d5..ab6e5cc353503dab84eac5814572e63b60b5828f 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4411,11 +4411,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 		sUnderWaterRender = FALSE;
 	}
 
-	if (LLViewerFetchedTexture::sDefaultImagep)
-	{
-		gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
-		LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
-	}
+	gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
+	LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
+	
 
 	//////////////////////////////////////////////
 	//
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 07531e0d563a60981f3f0a4ffc21b649945d2041..7297ba4fc02a8d8516b94aeac457e78cd8ec309d 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -271,7 +271,7 @@ See the [[MARKETPLACE_IMPORTS_URL] error log] for more information.
    icon="OutboxStatus_Error"
    name="OutboxImportFailed"
    type="outbox">
-Transfer failed
+Transfer failed with error &apos;[ERROR_CODE]&apos;
 
 No folders were sent to the Marketplace because of a system or network error.  Try again later.
 
@@ -284,7 +284,7 @@ No folders were sent to the Marketplace because of a system or network error.  T
    icon="OutboxStatus_Error"
    name="OutboxInitFailed"
    type="outbox">
-Marketplace initialization failed
+Marketplace initialization failed with error &apos;[ERROR_CODE]&apos;
 
 Initialization with the Marketplace failed because of a system or network error.  Try again later.
 
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index f0ff6d5b88b14e03e4d2b6d55457247620a23229..a0ad694f529922cd9f3c72f56d2bedd5724031dd 100755
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2245,6 +2245,16 @@ If you'd like to become a merchant, you'll need to [[MARKETPLACE_CREATE_STORE_UR
 	<string name="InventoryOutboxNoItems">
 Drag folders to this area and click "Send to Marketplace" to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace].
 	</string>
+	<string name="InventoryOutboxInitializingTitle">Initializing Marketplace.</string>
+	<string name="InventoryOutboxInitializingTooltip"></string>
+	<string name="InventoryOutboxInitializing">
+We are accessing your account on the [[MARKETPLACE_CREATE_STORE_URL] Marketplace store].
+	</string>
+	<string name="InventoryOutboxErrorTitle">Marketplace Errors.</string>
+	<string name="InventoryOutboxErrorTooltip"></string>
+	<string name="InventoryOutboxError">
+The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors.
+	</string>
 
 	<string name="Marketplace Error None">No errors</string>
 	<string name="Marketplace Error Not Merchant">Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string>
diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp
index 9fd66d542113ceaa5cdf6b9bbd0aed0a12a27927..6a272fd16659431b771653ea10f0bd3457d49375 100644
--- a/indra/win_crash_logger/llcrashloggerwindows.cpp
+++ b/indra/win_crash_logger/llcrashloggerwindows.cpp
@@ -484,7 +484,7 @@ bool LLCrashLoggerWindows::mainLoop()
 	if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND)
 	{
 		llinfos << "Showing crash report submit progress window." << llendl;
-		ShowWindow(gHwndProgress, SW_SHOW );
+		//ShowWindow(gHwndProgress, SW_SHOW );   Maint-5707
 		sendCrashLogs();
 	}
 	else if (mCrashBehavior == CRASH_BEHAVIOR_ASK)