From ae95759bcf70e900d822bc8a80f3eda36de2bdf7 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 11 Jan 2018 15:17:21 +0200
Subject: [PATCH] MAINT-8170 Crash viewer when double click on "Report Abuse"

---
 indra/newview/llfloaterreporter.cpp | 13 ++++++++++---
 indra/newview/llfloaterreporter.h   |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index c0f5e636238..3a3660bb310 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -162,7 +162,8 @@ LLFloaterReporter::LLFloaterReporter(const LLSD& key)
 	mPosition(),
 	mCopyrightWarningSeen( FALSE ),
 	mResourceDatap(new LLResourceData()),
-	mAvatarNameCacheConnection()
+	mAvatarNameCacheConnection(),
+	mSnapshotTimer()
 {
 }
 
@@ -245,6 +246,12 @@ LLFloaterReporter::~LLFloaterReporter()
 void LLFloaterReporter::draw()
 {
 	LLFloater::draw();
+	static LLCachedControl<F32> screenshot_delay(gSavedSettings, "AbuseReportScreenshotDelay");
+	if (mSnapshotTimer.getStarted() && mSnapshotTimer.getElapsedTimeF32() > screenshot_delay)
+	{
+		mSnapshotTimer.stop();
+		takeNewSnapshot();
+	}
 }
 
 void LLFloaterReporter::enableControls(BOOL enable)
@@ -877,8 +884,7 @@ void LLFloaterReporter::onOpen(const LLSD& key)
 {
 	childSetEnabled("send_btn", false);
 	//Time delay to avoid UI artifacts. MAINT-7067
-	doAfterInterval(boost::bind(&LLFloaterReporter::takeNewSnapshot,this), gSavedSettings.getF32("AbuseReportScreenshotDelay"));
-
+	mSnapshotTimer.start();
 }
 
 void LLFloaterReporter::onLoadScreenshotDialog(const LLSD& notification, const LLSD& response)
@@ -950,6 +956,7 @@ void LLFloaterReporter::setPosBox(const LLVector3d &pos)
 
 void LLFloaterReporter::onClose(bool app_quitting)
 {
+	mSnapshotTimer.stop();
 	gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", app_quitting);
 }
 
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index decc01be984..f5ba63ce7fe 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -149,6 +149,7 @@ class LLFloaterReporter
 
 	LLPointer<LLImageRaw> mImageRaw;
 	LLPointer<LLImageRaw> mPrevImageRaw;
+	LLFrameTimer	mSnapshotTimer;
 };
 
 #endif
-- 
GitLab