mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 15:59:23 +01:00
Bunch of tiny memory leaks fixed and cleanup, フウ〜!
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5056 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b6aa5d91c0
commit
5b1d21d1a1
5
Externals/WiiUseSrc/Src/io_osx.m
vendored
5
Externals/WiiUseSrc/Src/io_osx.m
vendored
@ -30,7 +30,7 @@
|
|||||||
* @file
|
* @file
|
||||||
* @brief Handles device I/O for *nix.
|
* @brief Handles device I/O for *nix.
|
||||||
*/
|
*/
|
||||||
|
#define BLUETOOTH_VERSION_USE_CURRENT
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -225,7 +225,7 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout) {
|
|||||||
int found_devices;
|
int found_devices;
|
||||||
int found_wiimotes;
|
int found_wiimotes;
|
||||||
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
IOBluetoothHostController *bth = [[IOBluetoothHostController alloc] init];
|
IOBluetoothHostController *bth = [[IOBluetoothHostController alloc] init];
|
||||||
if([bth addressAsString] == nil)
|
if([bth addressAsString] == nil)
|
||||||
@ -250,6 +250,7 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout) {
|
|||||||
|
|
||||||
WIIMOTE_ENABLE_STATE(wm[found_wiimotes], WIIMOTE_STATE_DEV_FOUND);
|
WIIMOTE_ENABLE_STATE(wm[found_wiimotes], WIIMOTE_STATE_DEV_FOUND);
|
||||||
|
|
||||||
|
[bth release];
|
||||||
[bti release];
|
[bti release];
|
||||||
[sbt release];
|
[sbt release];
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ char **cdio_get_devices() {
|
|||||||
#elif __linux__
|
#elif __linux__
|
||||||
return cdio_get_devices_linux();
|
return cdio_get_devices_linux();
|
||||||
#else
|
#else
|
||||||
// todo add somewarning
|
#warning CDIO not supported on your platform!
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,14 @@ void SleepCurrentThread(int ms)
|
|||||||
|
|
||||||
void SetCurrentThreadName(const TCHAR* szThreadName)
|
void SetCurrentThreadName(const TCHAR* szThreadName)
|
||||||
{
|
{
|
||||||
pthread_setspecific(threadname_key, strdup(szThreadName));
|
char *name = strdup(szThreadName);
|
||||||
|
// pthread_setspecific returns 0 on success
|
||||||
|
// free the string from strdup if fails
|
||||||
|
// creates a memory leak if it actually doesn't fail
|
||||||
|
// since we don't delete it once we delete the thread
|
||||||
|
// we are using a single threadname_key anyway for all threads
|
||||||
|
if(!pthread_setspecific(threadname_key, strdup(szThreadName)))
|
||||||
|
free(name);
|
||||||
INFO_LOG(COMMON, "%s(%s)\n", __FUNCTION__, szThreadName);
|
INFO_LOG(COMMON, "%s(%s)\n", __FUNCTION__, szThreadName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
namespace FileMon
|
namespace FileMon
|
||||||
{
|
{
|
||||||
|
|
||||||
DiscIO::IVolume *OpenISO;
|
DiscIO::IVolume *OpenISO = NULL;
|
||||||
DiscIO::IFileSystem *pFileSystem = NULL;
|
DiscIO::IFileSystem *pFileSystem = NULL;
|
||||||
std::vector<const DiscIO::SFileInfo *> GCFiles;
|
std::vector<const DiscIO::SFileInfo *> GCFiles;
|
||||||
std::string ISOFile = "", CurrentFile = "";
|
std::string ISOFile = "", CurrentFile = "";
|
||||||
@ -70,6 +70,18 @@ bool ShowSound(std::string FileName)
|
|||||||
// Read the GC file system
|
// Read the GC file system
|
||||||
void ReadGC(std::string FileName)
|
void ReadGC(std::string FileName)
|
||||||
{
|
{
|
||||||
|
// Should have an actual Shutdown procedure or something
|
||||||
|
if(OpenISO != NULL)
|
||||||
|
{
|
||||||
|
delete OpenISO;
|
||||||
|
OpenISO = NULL;
|
||||||
|
}
|
||||||
|
if(pFileSystem != NULL)
|
||||||
|
{
|
||||||
|
delete pFileSystem;
|
||||||
|
pFileSystem = NULL;
|
||||||
|
}
|
||||||
|
// GCFiles' pointers are no longer valid after pFileSystem is cleared
|
||||||
GCFiles.clear();
|
GCFiles.clear();
|
||||||
OpenISO = DiscIO::CreateVolumeFromFilename(FileName);
|
OpenISO = DiscIO::CreateVolumeFromFilename(FileName);
|
||||||
if (!OpenISO) return;
|
if (!OpenISO) return;
|
||||||
|
@ -37,6 +37,7 @@ CFileSystemGCWii::CFileSystemGCWii(const IVolume *_rVolume)
|
|||||||
|
|
||||||
CFileSystemGCWii::~CFileSystemGCWii()
|
CFileSystemGCWii::~CFileSystemGCWii()
|
||||||
{
|
{
|
||||||
|
m_FileInfoVector.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFileSystemGCWii::IsInitialized() const
|
bool CFileSystemGCWii::IsInitialized() const
|
||||||
|
@ -114,13 +114,17 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
|||||||
LoadGameConfig();
|
LoadGameConfig();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Will fail out if GameConfig folder doesn't exist
|
||||||
FILE *f = fopen(GameIniFile.c_str(), "w");
|
FILE *f = fopen(GameIniFile.c_str(), "w");
|
||||||
fprintf(f, "# %s - %s\n", OpenISO->GetUniqueID().c_str(), OpenISO->GetName().c_str());
|
if (f)
|
||||||
fprintf(f, "[Core] Values set here will override the main dolphin settings.\n");
|
{
|
||||||
fprintf(f, "[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.\n");
|
fprintf(f, "# %s - %s\n", OpenISO->GetUniqueID().c_str(), OpenISO->GetName().c_str());
|
||||||
fprintf(f, "[OnFrame] Add memory patches to be applied every frame here.\n");
|
fprintf(f, "[Core] Values set here will override the main dolphin settings.\n");
|
||||||
fprintf(f, "[ActionReplay] Add action replay cheats here.\n");
|
fprintf(f, "[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.\n");
|
||||||
fclose(f);
|
fprintf(f, "[OnFrame] Add memory patches to be applied every frame here.\n");
|
||||||
|
fprintf(f, "[ActionReplay] Add action replay cheats here.\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
if (GameIni.Load(GameIniFile.c_str()))
|
if (GameIni.Load(GameIniFile.c_str()))
|
||||||
LoadGameConfig();
|
LoadGameConfig();
|
||||||
else
|
else
|
||||||
@ -203,20 +207,13 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
|||||||
|
|
||||||
CISOProperties::~CISOProperties()
|
CISOProperties::~CISOProperties()
|
||||||
{
|
{
|
||||||
if (IsVolumeWiiDisc(OpenISO))
|
if (!IsVolumeWiiDisc(OpenISO))
|
||||||
{
|
|
||||||
for (std::vector<WiiPartition>::const_iterator PartIter = WiiDisc.begin(); PartIter != WiiDisc.end(); ++PartIter)
|
|
||||||
{
|
|
||||||
delete PartIter->FileSystem; // Remember the FileList is a member of DiscIO::IFileSystem
|
|
||||||
delete PartIter->Partition;
|
|
||||||
}
|
|
||||||
WiiDisc.clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!IsVolumeWadFile(OpenISO))
|
if (!IsVolumeWadFile(OpenISO))
|
||||||
if (pFileSystem)
|
if (pFileSystem)
|
||||||
delete pFileSystem;
|
delete pFileSystem;
|
||||||
|
// two vector's items are no longer valid after deleting filesystem
|
||||||
|
WiiDisc.clear();
|
||||||
|
GCFiles.clear();
|
||||||
delete OpenGameListItem;
|
delete OpenGameListItem;
|
||||||
delete OpenISO;
|
delete OpenISO;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,8 @@ void DllConfig(HWND _hParent)
|
|||||||
|
|
||||||
if (!m_ConfigFrame)
|
if (!m_ConfigFrame)
|
||||||
{
|
{
|
||||||
m_ConfigFrame = new DSPConfigDialogHLE(GetParentedWxWindow(_hParent));
|
wxWindow *frame = GetParentedWxWindow(_hParent);
|
||||||
|
m_ConfigFrame = new DSPConfigDialogHLE(frame);
|
||||||
|
|
||||||
// add backends
|
// add backends
|
||||||
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
||||||
@ -192,6 +193,7 @@ void DllConfig(HWND _hParent)
|
|||||||
m_ConfigFrame->ShowModal();
|
m_ConfigFrame->ShowModal();
|
||||||
|
|
||||||
delete m_ConfigFrame;
|
delete m_ConfigFrame;
|
||||||
|
delete frame;
|
||||||
m_ConfigFrame = 0;
|
m_ConfigFrame = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -169,10 +169,12 @@ void DllConfig(HWND _hParent)
|
|||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
if (!m_ConfigFrame)
|
if (!m_ConfigFrame)
|
||||||
{
|
{
|
||||||
m_ConfigFrame = new GCPadConfigDialog(GetParentedWxWindow(_hParent));
|
wxWindow *frame = GetParentedWxWindow(_hParent);
|
||||||
|
m_ConfigFrame = new GCPadConfigDialog(frame);
|
||||||
m_ConfigFrame->ShowModal();
|
m_ConfigFrame->ShowModal();
|
||||||
m_ConfigFrame->Destroy();
|
m_ConfigFrame->Destroy();
|
||||||
m_ConfigFrame = NULL;
|
m_ConfigFrame = NULL;
|
||||||
|
delete frame;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,8 @@ void DllConfig(HWND _hParent)
|
|||||||
// Prevent user to show more than 1 config window at same time
|
// Prevent user to show more than 1 config window at same time
|
||||||
if (allowConfigShow)
|
if (allowConfigShow)
|
||||||
{
|
{
|
||||||
m_ConfigFrame = new GFXConfigDialogOGL(GetParentedWxWindow(_hParent));
|
wxWindow *frame = GetParentedWxWindow(_hParent);
|
||||||
|
m_ConfigFrame = new GFXConfigDialogOGL(frame);
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
Win32AddResolutions();
|
Win32AddResolutions();
|
||||||
@ -314,6 +315,7 @@ void DllConfig(HWND _hParent)
|
|||||||
allowConfigShow = m_ConfigFrame->ShowModal() == 1 ? true : false;
|
allowConfigShow = m_ConfigFrame->ShowModal() == 1 ? true : false;
|
||||||
|
|
||||||
delete m_ConfigFrame;
|
delete m_ConfigFrame;
|
||||||
|
delete frame;
|
||||||
m_ConfigFrame = 0;
|
m_ConfigFrame = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -183,10 +183,12 @@ void DllConfig(HWND _hParent)
|
|||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
if (!m_BasicConfigFrame)
|
if (!m_BasicConfigFrame)
|
||||||
{
|
{
|
||||||
m_BasicConfigFrame = new WiimoteBasicConfigDialog(GetParentedWxWindow(_hParent));
|
wxWindow *frame = GetParentedWxWindow(_hParent);
|
||||||
|
m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame);
|
||||||
m_BasicConfigFrame->ShowModal();
|
m_BasicConfigFrame->ShowModal();
|
||||||
m_BasicConfigFrame->Destroy();
|
m_BasicConfigFrame->Destroy();
|
||||||
m_BasicConfigFrame = NULL;
|
m_BasicConfigFrame = NULL;
|
||||||
|
delete frame;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user