summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2009-10-25 02:03:45 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2009-10-25 02:03:45 +0000
commit73fda8cfbf6b4e60162b2262aa932da60563dc07 (patch)
tree7cbbbe1146411446e0188687fbc8fbdc9e4456eb /Source/Core/DiscIO
parent1ce145e86ed33df64b6e08e5977366cecc2f69bf (diff)
Fix a possible crash on close due to INANDContentLoader objects getting deleted twice
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4463 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Src/NANDContentLoader.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
index 93fd9458f3..1d6c9e7746 100644
--- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
@@ -164,7 +164,7 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
}
else
{
-// _dbg_assert_msg_(BOOT, 0, "CNANDContentLoader loads neither folder nor file");
+ _dbg_assert_msg_(BOOT, 0, "CNANDContentLoader loads neither folder nor file");
}
}
@@ -362,14 +362,12 @@ CNANDContentManager::~CNANDContentManager()
const INANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string& _rName)
{
- std::string KeyString(_rName);
+ CNANDContentMap::iterator lb = m_Map.lower_bound(_rName);
- CNANDContentMap::iterator itr = m_Map.find(KeyString);
- if (itr != m_Map.end())
- return *itr->second;
+ if(lb == m_Map.end() || (m_Map.key_comp()(_rName, lb->first)))
+ m_Map.insert(lb, CNANDContentMap::value_type(_rName, new CNANDContentLoader(_rName)));
- m_Map[KeyString] = new CNANDContentLoader(KeyString);
- return *m_Map[KeyString];
+ return *m_Map[_rName];
}
} // namespace end