Fix the worst memory leaks on emulator suspends.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3063 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-05-23 13:56:44 +00:00
parent ef5124e6d3
commit d09c269d17
6 changed files with 13 additions and 23 deletions

View File

@ -137,12 +137,10 @@ EXPORT_C GSclose()
{
if( !s_gs ) return;
s_gs->ResetDevice();
delete s_gs->m_dev;
s_gs->m_dev = NULL;
s_gs->m_wnd.Detach();
delete s_gs;
s_gs = NULL;
}
static INT32 _GSopen(void* dsp, char* title, int renderer)
@ -158,16 +156,6 @@ static INT32 _GSopen(void* dsp, char* title, int renderer)
try
{
if (s_renderer != renderer)
{
// Emulator has made a render change request, which requires a completely
// new s_gs -- if the emu doesn't save/restore the GS state across this
// GSopen call then they'll get corrupted graphics, but that's not my problem.
delete s_gs;
s_gs = NULL;
}
switch(renderer)
{
default:
@ -245,6 +233,7 @@ static INT32 _GSopen(void* dsp, char* title, int renderer)
EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags )
{
GSclose();
int renderer = theApp.GetConfig("renderer", 0);
if( flags & 4 )
{
@ -261,6 +250,7 @@ EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags )
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
{
GSclose();
int renderer;
// Legacy GUI expects to acquire vsync from the configuration files.

View File

@ -44,7 +44,7 @@ GSDevice::GSDevice()
GSDevice::~GSDevice()
{
for_each(m_pool.begin(), m_pool.end(), delete_object());
m_pool.clear();
delete m_backbuffer;
delete m_merge;
delete m_weavebob;

View File

@ -52,14 +52,12 @@ GSRenderer::GSRenderer()
GSRenderer::~GSRenderer()
{
/*if(m_dev)
if(m_dev)
{
m_dev->Reset(1, 1, GSDevice::Windowed);
}*/
m_dev->Reset(1, 1);
delete m_dev;
}
_aligned_free( m_tex_buff );
delete m_dev;
}
bool GSRenderer::CreateWnd(const string& title, int w, int h)

View File

@ -455,7 +455,7 @@ protected:
void Reset()
{
// TODO: GSreset can come from the main thread too => crash
// m_tc->RemoveAll();
m_tc->RemoveAll();
m_reset = true;

View File

@ -35,6 +35,7 @@ class GSTexture11 : public GSTexture
public:
explicit GSTexture11(ID3D11Texture2D* texture);
virtual ~GSTexture11() {};
bool Update(const GSVector4i& r, const void* data, int pitch);
bool Map(GSMap& m, const GSVector4i* r);

View File

@ -32,5 +32,6 @@ protected:
void Read(Target* t, const GSVector4i& r);
public:
virtual ~GSTextureCache11() {};
GSTextureCache11(GSRenderer* r);
};