Some more leak hunting/housekeeping, probably wont affect Issue 2184 in a noticeable way tho.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5046 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st 2010-02-12 19:28:51 +00:00
parent 99ea22bbf3
commit df1be33ba9
6 changed files with 24 additions and 9 deletions

View File

@ -233,6 +233,7 @@ protected:
public:
XEmitter() { code = NULL; }
XEmitter(u8 *code_ptr) { code = code_ptr; }
virtual ~XEmitter() {}
void WriteModRM(int mod, int rm, int reg);
void WriteSIB(int scale, int index, int base);

View File

@ -262,7 +262,7 @@ void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename)
/* Called from: Get__() functions in this file only (not from anywhere else),
therefore we can leave all condition checks in the Get__() functions
below. */
void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)
void *CPluginManager::LoadPlugin(const char *_rFilename)
{
// Create a string of the filename
std::string Filename = _rFilename;
@ -275,7 +275,7 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)
Dolphin was started */
CPluginInfo *info = NULL;
GetPluginInfo(info, Filename);
if (! info) {
if (!info) {
PanicAlert("Error loading %s: can't read info", _rFilename);
return NULL;
}
@ -303,12 +303,14 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)
default:
PanicAlert("Trying to load unsupported type %d", type);
return NULL;
}
// Check that the plugin has both all the common and all the type specific functions
if (!plugin->IsValid())
{
PanicAlert("Can't open %s, it has a missing function", _rFilename);
delete plugin;
return NULL;
}
@ -379,8 +381,12 @@ void CPluginManager::ScanForPlugins()
Common::PluginPAD *CPluginManager::GetPad(int controller)
{
if (m_pad[controller] != NULL)
{
if (m_pad[controller]->GetFilename() == m_params->m_strPadPlugin[controller])
return m_pad[controller];
else
FreePad(controller);
}
// Else load a new plugin
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin[controller].c_str());
@ -390,8 +396,12 @@ Common::PluginPAD *CPluginManager::GetPad(int controller)
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
{
if (m_wiimote[controller] != NULL)
{
if (m_wiimote[controller]->GetFilename() == m_params->m_strWiimotePlugin[controller])
return m_wiimote[controller];
else
FreeWiimote(controller);
}
// Else load a new plugin
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params->m_strWiimotePlugin[controller].c_str());
@ -401,8 +411,12 @@ Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
Common::PluginDSP *CPluginManager::GetDSP()
{
if (m_dsp != NULL)
{
if (m_dsp->GetFilename() == m_params->m_strDSPPlugin)
return m_dsp;
else
FreeDSP();
}
// Else load a new plugin
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params->m_strDSPPlugin.c_str());
return m_dsp;

View File

@ -82,7 +82,7 @@ private:
CPluginManager();
~CPluginManager();
void GetPluginInfo(CPluginInfo *&info, std::string Filename);
void *LoadPlugin(const char *_rFilename, int Number = 0);
void *LoadPlugin(const char *_rFilename);
};

View File

@ -143,6 +143,7 @@ void CJitWindow::Compare(u32 em_address)
if (block_num < 0) {
ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)", em_address).c_str()));
x86_box->SetValue(wxString::FromAscii(StringFromFormat("(no translation)").c_str()));
delete[] xDis;
return;
}
}
@ -210,7 +211,7 @@ void CJitWindow::Compare(u32 em_address)
}
delete [] xDis;
delete[] xDis;
}
void CJitWindow::Update()

View File

@ -98,7 +98,8 @@ GameListItem::GameListItem(const std::string& _rFileName)
if (pBannerLoader->GetBanner(g_ImageTemp))
{
m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3;
m_pImage = new u8[m_ImageSize]; //(u8*)malloc(m_ImageSize);
//use malloc(), since wxImage::Create below calls free() afterwards.
m_pImage = (u8*)malloc(m_ImageSize);
for (size_t i = 0; i < DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT; i++)
{
@ -125,12 +126,9 @@ GameListItem::GameListItem(const std::string& _rFileName)
}
}
// i am not sure if this is a leak or if wxImage will release the code
if (m_pImage)
{
#if defined(HAVE_WX) && HAVE_WX
m_Image.Create(DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT, m_pImage);
#endif
}
else
{

View File

@ -214,9 +214,10 @@ CISOProperties::~CISOProperties()
}
else
if (!IsVolumeWadFile(OpenISO))
if(pFileSystem)
if (pFileSystem)
delete pFileSystem;
delete OpenGameListItem;
delete OpenISO;
}