Should fix a crash that was deleting a invalid pointer that happens when we unload plugins before freeing pads, if this causes problems anywhere, please tell me

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4553 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2009-11-13 09:04:17 +00:00
parent ee88afce58
commit 173c16ad41
1 changed files with 4 additions and 5 deletions

View File

@ -76,12 +76,11 @@ CPluginManager::~CPluginManager()
for (int i = 0; i < MAXPADS; i++) for (int i = 0; i < MAXPADS; i++)
{ {
if (m_pad[i] && (OkayToInitPlugin(i) == -1)) if (m_pad[i] && (OkayToInitPlugin(i) == -1) && !m_params->m_strPadPlugin[i].empty())
{ {
INFO_LOG(CONSOLE, "Delete: %i\n", i); INFO_LOG(CONSOLE, "Delete: %i\n", i);
delete m_pad[i]; FreePad(i);
} }
m_pad[i] = NULL;
} }
for (int i = 0; i < MAXWIIMOTES; i++) for (int i = 0; i < MAXWIIMOTES; i++)
@ -165,9 +164,9 @@ void CPluginManager::ShutdownPlugins()
if (m_pad[i]) if (m_pad[i])
{ {
m_pad[i]->Shutdown(); m_pad[i]->Shutdown();
//delete m_pad[i]; delete m_pad[i];
} }
//m_pad[i] = NULL; m_pad[i] = NULL;
} }
for (int i = 0; i < MAXWIIMOTES; i++) for (int i = 0; i < MAXWIIMOTES; i++)