From 516369594f475f93df290d6488c2eccd99618023 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 24 Jun 2014 12:28:02 -0500 Subject: Store ini sections in a std::list (rather than vector) to prevent unexpected pointer invalidation with use of GetOrCreateSection. --- Source/Core/Common/IniFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common/IniFile.cpp') diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 6159c2897d..da9d99e250 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -233,7 +233,7 @@ IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName) if (!section) { sections.push_back(Section(sectionName)); - section = §ions[sections.size() - 1]; + section = §ions.back(); } return section; } @@ -323,7 +323,7 @@ bool IniFile::GetLines(const std::string& sectionName, std::vector* void IniFile::SortSections() { - std::sort(sections.begin(), sections.end()); + sections.sort(); } bool IniFile::Load(const std::string& filename, bool keep_current_data) -- cgit v1.2.3