From 4c8b7f3926b8f19b4f7b9cddd39f921582fd3c55 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Fri, 17 Jul 2020 03:58:41 -0400
Subject: [PATCH] Fix error in rlv due to returning temporary instead of a
 const &

---
 indra/newview/rlvenvironment.cpp | 6 +++---
 indra/newview/rlvenvironment.h   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/indra/newview/rlvenvironment.cpp b/indra/newview/rlvenvironment.cpp
index d723630fdb1..970514ee46c 100644
--- a/indra/newview/rlvenvironment.cpp
+++ b/indra/newview/rlvenvironment.cpp
@@ -558,7 +558,7 @@ ERlvCmdRet RlvEnvironment::handleSetFn(const std::string& strRlvOption, const st
 }
 
 template<>
-std::string RlvEnvironment::handleLegacyGetFn<LLVector2>(const std::function<const LLVector2& (LLSettingsSkyPtr_t)>& getFn, U32 idxComponent)
+std::string RlvEnvironment::handleLegacyGetFn<LLVector2>(const std::function<LLVector2(LLSettingsSkyPtr_t)>& getFn, U32 idxComponent)
 {
 	if (idxComponent > 2)
 		return LLStringUtil::null;
@@ -566,7 +566,7 @@ std::string RlvEnvironment::handleLegacyGetFn<LLVector2>(const std::function<con
 }
 
 template<>
-std::string RlvEnvironment::handleLegacyGetFn<LLColor3>(const std::function<const LLColor3& (LLSettingsSkyPtr_t)>& getFn, U32 idxComponent)
+std::string RlvEnvironment::handleLegacyGetFn<LLColor3>(const std::function<LLColor3(LLSettingsSkyPtr_t)>& getFn, U32 idxComponent)
 {
 	if ( (idxComponent >= VRED) && (idxComponent <= VBLUE) )
 	{
@@ -672,7 +672,7 @@ void RlvEnvironment::registerSetEnvFn(const std::string& strFnName, const std::f
 }
 
 template<typename T>
-void RlvEnvironment::registerLegacySkyFn(const std::string& strFnName, const std::function<const T& (LLSettingsSkyPtr_t)>& getFn, const std::function<void(LLSettingsSkyPtr_t, const T&)>& setFn)
+void RlvEnvironment::registerLegacySkyFn(const std::string& strFnName, const std::function<T(LLSettingsSkyPtr_t)>& getFn, const std::function<void(LLSettingsSkyPtr_t, const T&)>& setFn)
 {
 	RLV_ASSERT(m_LegacyGetFnLookup.end() == m_LegacyGetFnLookup.find(strFnName));
 	m_LegacyGetFnLookup.insert(std::make_pair(strFnName, [this, getFn](const std::string& strRlvParam, U32 idxComponent)
diff --git a/indra/newview/rlvenvironment.h b/indra/newview/rlvenvironment.h
index 0f70e24cae2..1f6d577335e 100644
--- a/indra/newview/rlvenvironment.h
+++ b/indra/newview/rlvenvironment.h
@@ -45,12 +45,12 @@ class RlvEnvironment : public RlvExtCommandHandler
 	                     void registerGetEnvFn(const std::string& strFnName, const std::function<std::string(LLEnvironment::EnvSelection_t env)>& getFn);
 	template<typename T> void registerSetEnvFn(const std::string& strFnName, const std::function<ERlvCmdRet(LLEnvironment::EnvSelection_t env, const T& strRlvOption)>& setFn);
 	template<typename T> void registerSkyFn(const std::string& strFnName, const std::function<T(LLSettingsSky::ptr_t)>& getFn, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn);
-	template<typename T> void registerLegacySkyFn(const std::string& strFnName, const std::function<const T& (LLSettingsSky::ptr_t)>& getFn, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn);
+	template<typename T> void registerLegacySkyFn(const std::string& strFnName, const std::function<T(LLSettingsSky::ptr_t)>& getFn, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn);
 
 	// Command handling helpers
 	template<typename T> std::string handleGetFn(const std::function<T(LLSettingsSky::ptr_t)>& fn);
 	template<typename T> ERlvCmdRet  handleSetFn(const std::string& strRlvOption, const std::function<void(LLSettingsSky::ptr_t, const T&)>& fn);
-	template<typename T> std::string handleLegacyGetFn(const std::function<const T& (LLSettingsSky::ptr_t)>& getFn, U32 idxComponent);
+	template<typename T> std::string handleLegacyGetFn(const std::function<T(LLSettingsSky::ptr_t)>& getFn, U32 idxComponent);
 	template<typename T> ERlvCmdRet  handleLegacySetFn(float optionValue, T value, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn, U32 idxComponent);
 
 	/*
-- 
GitLab