diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-03-07 14:55:05 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-03-07 14:55:05 +0800 |
| commit | eac10375e294cd24c21c09497e838e70dcf4d74a (patch) | |
| tree | 4b53b1ebc1582e3323c80953236dca6b3a92ab65 /indra/llxml | |
| parent | 8142dd11b4cae8d4768a2d985a24340163a42a5c (diff) | |
| parent | 3529bc5f9d29a71355f3a3666540abff57dc1a4c (diff) | |
Merge tag 'Second_Life_Release#3529bc5f-2026.02' into 2026.02
Diffstat (limited to 'indra/llxml')
| -rw-r--r-- | indra/llxml/llcontrol.cpp | 31 | ||||
| -rw-r--r-- | indra/llxml/llcontrol.h | 6 |
2 files changed, 30 insertions, 7 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 562a30e8d1..34643d5f5c 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -157,9 +157,12 @@ LLControlVariable::LLControlVariable(const std::string& name, eControlType type, { if ((persist != PERSIST_NO) && mComment.empty()) { - // File isn't actually missing, but something is wrong with it - // so the main point is to warn user to reinstall - LLError::LLUserWarningMsg::showMissingFiles(); + std::string error_string = + "Second Life failed to initialize settings. Setting " + mName + " is invalid. " + "Either settings' files were supplied incorrectly or default files were corrupted." + "\n\nPlease reinstall viewer from https://secondlife.com/support/downloads/ and " + "contact https://support.secondlife.com if issue persists after reinstall."; + LLError::LLUserWarningMsg::show(error_string); LL_ERRS() << "Must supply a comment for control " << mName << LL_ENDL; } //Push back versus setValue'ing here, since we don't want to call a signal yet @@ -758,6 +761,7 @@ void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) // Returns number of controls loaded, so 0 if failure U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as) { + LL_PROFILE_ZONE_SCOPED; std::string name; LLXmlTree xml_controls; @@ -990,8 +994,9 @@ U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only return num_saved; } -U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) +U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values, bool error_when_no_comment) { + LL_PROFILE_ZONE_SCOPED; LLSD settings; llifstream infile; infile.open(filename.c_str()); @@ -1105,10 +1110,26 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v } } + std::string comment = control_map["Comment"].asString(); + if (!error_when_no_comment + && !set_default_values + && comment.empty()) + { + // Only error for default settings that should remind the developer to provide comments + // and otherwise indicate a problem with viewer's files. + // But permit this minor transgression in user's files. + // Otherwise user might have a hard time figuring out source of the error or how to fix it. + // Instead make setting to not persist so that unrecognized invalid settings won't be saved + // for the next run. + persist = LLControlVariable::PERSIST_NO; + comment = "Comment not provided, setting won't persist"; + LL_WARNS() << "Control " << name << " is missing a comment value. Setting will be marked as PERSIST_NO" << LL_ENDL; + } + declareControl(name, typeStringToEnum(control_map["Type"].asString()), control_map["Value"], - control_map["Comment"].asString(), + comment, persist, hidefromsettingseditor ); diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index da7268bf45..5aa2b9715e 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -33,8 +33,10 @@ #include "llrect.h" #include "llrefcount.h" #include "llinstancetracker.h" +#include "llstl.h" #include <functional> +#include <unordered_map> #include <vector> #include <boost/signals2.hpp> @@ -165,7 +167,7 @@ class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string> LOG_CLASS(LLControlGroup); protected: - typedef std::map<std::string, LLControlVariablePtr, std::less<> > ctrl_name_table_t; + using ctrl_name_table_t = std::unordered_map<std::string, LLControlVariablePtr, ll::string_hash, std::equal_to<>>; ctrl_name_table_t mNameTable; static const std::string mTypeString[TYPE_COUNT]; @@ -278,7 +280,7 @@ public: // as the given type. U32 loadFromFileLegacy(const std::string& filename, bool require_declaration = true, eControlType declare_as = TYPE_STRING); U32 saveToFile(const std::string& filename, bool nondefault_only); - U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); + U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true, bool error_when_no_comment = true); void resetToDefaults(); void incrCount(std::string_view name); |
