From 1bc6858c3b7e9f7d69f393423281bc8f5147ac19 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 9 Apr 2022 16:45:01 -0400
Subject: [PATCH] Fix saved credential login

---
 indra/newview/llpanellogin.cpp    | 2 +-
 indra/newview/llviewernetwork.cpp | 5 +++--
 indra/newview/llviewernetwork.h   | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 9f64107c46d..ed11e7a71f6 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -987,7 +987,7 @@ void LLPanelLogin::onClickConnect(bool commit_fields)
 		// the grid definitions may come from a user-supplied grids.xml, so they may not be good
 		LL_DEBUGS("AppInit")<<"grid "<<combo_val.asString()<<LL_ENDL;
 
-		LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+		LLGridManager::getInstance()->setGridChoice(combo_val.asString(), true, true);
 
 		// The start location SLURL has already been sent to LLStartUp::setStartSLURL
 
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 70ffcbf1306..9030601dd59 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -680,7 +680,7 @@ std::map<std::string, std::string> LLGridManager::getKnownGrids() const
 	return result;
 }
 
-void LLGridManager::setGridChoice(const std::string& grid, const bool only_select /* = true */)
+void LLGridManager::setGridChoice(const std::string& grid, const bool only_select /* = true */, const bool for_login /* = false */)
 {
 	// Can't change grid once we are logged in
 	if (mLoggedIn) return;
@@ -719,7 +719,8 @@ void LLGridManager::setGridChoice(const std::string& grid, const bool only_selec
 		// the grid was not in the list of grids.
 		LL_WARNS("GridManager")<<"unknown grid "<<grid<<LL_ENDL;
 	}
-	mGridListChangedSignal();
+	if(!for_login)
+		mGridListChangedSignal();
 }
 
 std::string LLGridManager::getGrid(const std::string& grid) const
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 7e2f06bdf14..b771fff8a28 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -225,7 +225,7 @@ class LLGridManager final : public LLSingleton<LLGridManager>
 	 */
 
 	/// Select a given grid as the current grid.
-	void setGridChoice(const std::string& grid, const bool only_select = true);
+	void setGridChoice(const std::string& grid, const bool only_select = true, const bool for_login = false);
 
 	/// Returns the name of the currently selected grid 
 	std::string getGrid() const { return mGrid; }
-- 
GitLab