From c8033c2ef760d5e1b875a6ce2b791c3975ac3b9a Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 16 Apr 2014 08:12:38 -0700 Subject: [PATCH] Initialize the charset converter for the thesaurus sooner Narrows the window of time for a crash-on-exit when the user exits while a thesaurus is being loaded. --- libaegisub/common/thesaurus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libaegisub/common/thesaurus.cpp b/libaegisub/common/thesaurus.cpp index a1bb801e0..de4497f92 100644 --- a/libaegisub/common/thesaurus.cpp +++ b/libaegisub/common/thesaurus.cpp @@ -43,6 +43,8 @@ Thesaurus::Thesaurus(agi::fs::path const& dat_path, agi::fs::path const& idx_pat std::string unused_entry_count; getline(idx, unused_entry_count); + conv.reset(new charset::IconvWrapper(encoding_name.c_str(), "utf-8")); + // Read the list of words and file offsets for those words for (auto const& line : line_iterator(idx, encoding_name)) { std::vector chunks; @@ -50,8 +52,6 @@ Thesaurus::Thesaurus(agi::fs::path const& dat_path, agi::fs::path const& idx_pat if (chunks.size() == 2) offsets[chunks[0]] = atoi(chunks[1].c_str()); } - - conv.reset(new charset::IconvWrapper(encoding_name.c_str(), "utf-8")); } Thesaurus::~Thesaurus() { }