From 52fe6676716daab90b00f4d3696b081608f07f6c Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Tue, 11 Feb 2014 13:58:44 +0200
Subject: MAINT-2754 FIXED Call findInstance() instead of getInstance().

---
 indra/newview/llfloatersnapshot.cpp | 24 +++++++++++++++---------
 indra/newview/llfloatersnapshot.h   |  1 +
 indra/newview/llviewermenufile.cpp  |  4 +++-
 3 files changed, 19 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index a416765157..d9835292a1 100755
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1252,7 +1252,7 @@ S32 LLFloaterSnapshot::notify(const LLSD& info)
 //static 
 void LLFloaterSnapshot::update()
 {
-	LLFloaterSnapshot* inst = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* inst = findInstance();
 	LLFloaterSocial* floater_social  = LLFloaterReg::findTypedInstance<LLFloaterSocial>("social"); 
 
 	if (!inst && !floater_social)
@@ -1279,13 +1279,19 @@ LLFloaterSnapshot* LLFloaterSnapshot::getInstance()
 	return LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");
 }
 
+// static
+LLFloaterSnapshot* LLFloaterSnapshot::findInstance()
+{
+	return LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+}
+
 // static
 void LLFloaterSnapshot::saveTexture()
 {
 	lldebugs << "saveTexture" << llendl;
 
 	// FIXME: duplicated code
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (!instance)
 	{
 		llassert(instance != NULL);
@@ -1306,7 +1312,7 @@ BOOL LLFloaterSnapshot::saveLocal()
 {
 	lldebugs << "saveLocal" << llendl;
 	// FIXME: duplicated code
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (!instance)
 	{
 		llassert(instance != NULL);
@@ -1326,7 +1332,7 @@ BOOL LLFloaterSnapshot::saveLocal()
 void LLFloaterSnapshot::preUpdate()
 {
 	// FIXME: duplicated code
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (instance)
 	{
 		// Disable the send/post/save buttons until snapshot is ready.
@@ -1341,7 +1347,7 @@ void LLFloaterSnapshot::preUpdate()
 void LLFloaterSnapshot::postUpdate()
 {
 	// FIXME: duplicated code
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (instance)
 	{
 		// Enable the send/post/save buttons.
@@ -1362,7 +1368,7 @@ void LLFloaterSnapshot::postUpdate()
 // static
 void LLFloaterSnapshot::postSave()
 {
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (!instance)
 	{
 		llassert(instance != NULL);
@@ -1388,7 +1394,7 @@ LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData()
 {
 	// FIXME: May not work for textures.
 
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (!instance)
 	{
 		llassert(instance != NULL);
@@ -1415,7 +1421,7 @@ LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData()
 // static
 const LLVector3d& LLFloaterSnapshot::getPosTakenGlobal()
 {
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (!instance)
 	{
 		llassert(instance != NULL);
@@ -1435,7 +1441,7 @@ const LLVector3d& LLFloaterSnapshot::getPosTakenGlobal()
 // static
 void LLFloaterSnapshot::setAgentEmail(const std::string& email)
 {
-	LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
+	LLFloaterSnapshot* instance = findInstance();
 	if (instance)
 	{
 		LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container");
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 82af8c7a9d..c757bf21c2 100755
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -56,6 +56,7 @@ public:
 
 	// TODO: create a snapshot model instead
 	static LLFloaterSnapshot* getInstance();
+	static LLFloaterSnapshot* findInstance();
 	static void saveTexture();
 	static BOOL saveLocal();
 	static void preUpdate();
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index be78603e2d..4c95dcd6a2 100755
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -494,7 +494,9 @@ class LLFileEnableCloseAllWindows : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		bool open_children = gFloaterView->allChildrenClosed() && !LLFloaterSnapshot::getInstance()->isInVisibleChain();
+		LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
+		bool is_floater_snapshot_opened = floater_snapshot && floater_snapshot->isInVisibleChain();
+		bool open_children = gFloaterView->allChildrenClosed() && !is_floater_snapshot_opened;
 		return !open_children;
 	}
 };
-- 
cgit v1.2.3