mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
Merge pull request #534 from jordan-woyak/ini-file-fix
Store ini sections in a std::list to prevent pointer invalidation.
This commit is contained in:
commit
832d0bbdb9
@ -233,7 +233,7 @@ IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName)
|
|||||||
if (!section)
|
if (!section)
|
||||||
{
|
{
|
||||||
sections.push_back(Section(sectionName));
|
sections.push_back(Section(sectionName));
|
||||||
section = §ions[sections.size() - 1];
|
section = §ions.back();
|
||||||
}
|
}
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ bool IniFile::GetLines(const std::string& sectionName, std::vector<std::string>*
|
|||||||
|
|
||||||
void IniFile::SortSections()
|
void IniFile::SortSections()
|
||||||
{
|
{
|
||||||
std::sort(sections.begin(), sections.end());
|
sections.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IniFile::Load(const std::string& filename, bool keep_current_data)
|
bool IniFile::Load(const std::string& filename, bool keep_current_data)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -116,7 +117,7 @@ public:
|
|||||||
Section* GetOrCreateSection(const std::string& section);
|
Section* GetOrCreateSection(const std::string& section);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Section> sections;
|
std::list<Section> sections;
|
||||||
|
|
||||||
const Section* GetSection(const std::string& section) const;
|
const Section* GetSection(const std::string& section) const;
|
||||||
Section* GetSection(const std::string& section);
|
Section* GetSection(const std::string& section);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user