From 2b0318ffd07b20a523c58156718ffab1a9d51271 Mon Sep 17 00:00:00 2001
From: Zi Ree <none@none>
Date: Tue, 10 Apr 2012 16:01:46 -0400
Subject: STORM-1842 Don't save per-account settings if login not fully
 successful Repo created from Firestorm patch by Jonathan Yap

---
 indra/newview/llappviewer.cpp | 12 ++++++++++++
 indra/newview/llappviewer.h   |  1 +
 2 files changed, 13 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 49fbdbf1df..c0197db4fc 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -622,6 +622,7 @@ LLAppViewer::LLAppViewer() :
 	mPurgeOnExit(false),
 	mSecondInstance(false),
 	mSavedFinalSnapshot(false),
+	mSavePerAccountSettings(false),		// don't save settings on logout unless login succeeded.
 	mForceGraphicsDetail(false),
 	mQuitRequested(false),
 	mLogoutRequestSent(false),
@@ -1739,6 +1740,13 @@ bool LLAppViewer::cleanup()
 	{
 		llinfos << "Not saving per-account settings; don't know the account name yet." << llendl;
 	}
+	// Only save per account settings if the previous login succeeded, otherwise
+	// we might end up with a cleared out settings file in case a previous login
+	// failed after loading per account settings.
+	else if (!mSavePerAccountSettings)
+	{
+		llinfos << "Not saving per-account settings; last login was not successful." << llendl;
+	}
 	else
 	{
 		gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
@@ -4953,6 +4961,10 @@ void LLAppViewer::handleLoginComplete()
 	mOnLoginCompleted();
 
 	writeDebugInfo();
+
+	// we logged in successfully, so save settings on logout
+	llinfos << "Login successful, per account settings will be saved on log out." << llendl;
+	mSavePerAccountSettings=TRUE;
 }
 
 // *TODO - generalize this and move DSO wrangling to a helper class -brad
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 71a7868191..a3d19301e7 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -251,6 +251,7 @@ private:
     bool mPurgeOnExit;
 
 	bool mSavedFinalSnapshot;
+	bool mSavePerAccountSettings;		// only save per account settings if login succeeded
 
 	bool mForceGraphicsDetail;
 
-- 
cgit v1.2.3


From bea4733193121a3918269101ba68fd7282e158ae Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Tue, 1 May 2012 12:19:00 -0400
Subject: STORM-1842 Change variable setting from TRUE to true

---
 indra/newview/llappviewer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c0197db4fc..8e8db07078 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4964,7 +4964,7 @@ void LLAppViewer::handleLoginComplete()
 
 	// we logged in successfully, so save settings on logout
 	llinfos << "Login successful, per account settings will be saved on log out." << llendl;
-	mSavePerAccountSettings=TRUE;
+	mSavePerAccountSettings=true;
 }
 
 // *TODO - generalize this and move DSO wrangling to a helper class -brad
-- 
cgit v1.2.3