From 73fda8cfbf6b4e60162b2262aa932da60563dc07 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 25 Oct 2009 02:03:45 +0000 Subject: [PATCH] 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 --- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 18 ++++++------------ .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp | 6 +++--- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 12 +++++------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index 262b1b4ec5..4e008fadff 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -83,11 +83,11 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& // scan for the title ids listed in TMDs within /title/ m_TitleIDs.clear(); - m_TitleIDs.push_back(0x0000000100000002ULL); - // m_TitleIDs.push_back(0x0001000248414741ULL); - // m_TitleIDs.push_back(0x0001000248414341ULL); - // m_TitleIDs.push_back(0x0001000248414241ULL); - // m_TitleIDs.push_back(0x0001000248414141ULL); + m_TitleIDs.push_back(0x0000000100000002ULL); + //m_TitleIDs.push_back(0x0001000248414741ULL); + //m_TitleIDs.push_back(0x0001000248414341ULL); + //m_TitleIDs.push_back(0x0001000248414241ULL); + //m_TitleIDs.push_back(0x0001000248414141ULL); //FindValidTitleIDs(); @@ -97,13 +97,7 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es() { - CTitleToContentMap::const_iterator itr = m_NANDContent.begin(); - while(itr != m_NANDContent.end()) - { - if (itr->second) - delete itr->second; - itr++; - } + // Leave deletion of the INANDContentLoader objects to CNANDContentManager, don't do it here! m_NANDContent.clear(); } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index dd5a25c3ab..d3ac0ddd54 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -197,7 +197,7 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress) Extensions.push_back("*.*"); CFileSearch FileSearch(Extensions, Directories); - + u64 overAllSize = 0; for (size_t i=0; isecond; + 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