From 75f5df57b444574d66725801c348100d6d7b9175 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Wed, 21 Mar 2018 18:04:53 +0200
Subject: [PATCH] MAINT-8403 FIXED "Snapshot" is stuck and not responding after
 sending snapshot via e-mail

---
 indra/newview/llfloatersnapshot.cpp   | 7 ++++++-
 indra/newview/llfloatersnapshot.h     | 2 ++
 indra/newview/llviewerassetupload.cpp | 7 ++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 2d0002dcd88..25e3d74ebcb 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -54,7 +54,7 @@ LLSnapshotFloaterView* gSnapshotFloaterView = NULL;
 
 const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f;
 
-const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
+const S32 MAX_POSTCARD_DATASIZE = 1572864; // 1.5 megabyte, similar to simulator limit
 const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
 
 static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view");
@@ -1232,6 +1232,11 @@ S32 LLFloaterSnapshot::notify(const LLSD& info)
 	return 0;
 }
 
+BOOL LLFloaterSnapshot::isWaitingState()
+{
+	return (impl->getStatus() == ImplBase::STATUS_WORKING);
+}
+
 BOOL LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized)
 {
 	LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance<LLFloaterFacebook>("facebook");
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 1f303ea4d65..698273ac904 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -159,6 +159,8 @@ class LLFloaterSnapshot : public LLFloaterSnapshotBase
 	BOOL saveLocal();
 	static void setAgentEmail(const std::string& email);
 
+	BOOL isWaitingState();
+
 	class Impl;
 	friend class Impl;
 };
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 4f68c9a98ee..477b3a6f8d5 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -39,6 +39,7 @@
 #include "lleconomy.h"
 #include "llagent.h"
 #include "llfloaterreg.h"
+#include "llfloatersnapshot.h"
 #include "llstatusbar.h"
 #include "llinventorypanel.h"
 #include "llsdutil.h"
@@ -863,10 +864,10 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
     }
 
     // Let the Snapshot floater know we have failed uploading.
-    LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot");
-    if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_snapshot && floater_snapshot->isShown())
+    LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
+    if (uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG && floater_snapshot && floater_snapshot->isWaitingState())
     {
-        floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory")));
+        floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "postcard")));
     }
     LLFloater* floater_outfit_snapshot = LLFloaterReg::findInstance("outfit_snapshot");
     if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_outfit_snapshot && floater_outfit_snapshot->isShown())
-- 
GitLab