summaryrefslogtreecommitdiff
path: root/indra/llui/llspellcheck.cpp
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-08-13 18:39:57 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-08-14 00:31:37 -0400
commit2cff1e217ba0df94fc50a30c8d49dc848c294ac6 (patch)
treeb60df9f75e219d3bad7c975b6acd05cd357b1f05 /indra/llui/llspellcheck.cpp
parentad8dc13150b640ae9613e1edd8cc8c2c72b1e6b2 (diff)
Reduce UI draw stalls from LLSpellChecker singleton via simpleton
Diffstat (limited to 'indra/llui/llspellcheck.cpp')
-rw-r--r--indra/llui/llspellcheck.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 16ffd352cf..e15616a16b 100644
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -42,19 +42,13 @@ static const std::string DICT_FILE_USER = "user_dictionaries.xml";
LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal;
LLSpellChecker::LLSpellChecker()
- : mHunspell(NULL)
{
+ // Load initial dictionary information
+ refreshDictionaryMap();
}
LLSpellChecker::~LLSpellChecker()
{
- delete mHunspell;
-}
-
-void LLSpellChecker::initSingleton()
-{
- // Load initial dictionary information
- refreshDictionaryMap();
}
bool LLSpellChecker::checkSpelling(const std::string& word) const
@@ -300,8 +294,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_language)
{
if (mHunspell)
{
- delete mHunspell;
- mHunspell = NULL;
+ mHunspell.reset();
mDictLanguage.clear();
mDictFile.clear();
mIgnoreList.clear();
@@ -322,11 +315,11 @@ void LLSpellChecker::initHunspell(const std::string& dict_language)
const std::string filename_dic = dict_entry["name"].asString() + ".dic";
if ( (gDirUtilp->fileExists(user_path + filename_aff)) && (gDirUtilp->fileExists(user_path + filename_dic)) )
{
- mHunspell = new Hunspell((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str());
+ mHunspell = std::make_unique<Hunspell>((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str());
}
else if ( (gDirUtilp->fileExists(app_path + filename_aff)) && (gDirUtilp->fileExists(app_path + filename_dic)) )
{
- mHunspell = new Hunspell((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str());
+ mHunspell = std::make_unique<Hunspell>((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str());
}
if (!mHunspell)
{