diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index c9422f76f9..2092a8eefa 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -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. diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index 5a09097b79..7793eb0ddf 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -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; diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index a079a5964b..4afd795fba 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -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) diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index a54b2d2f21..b46d468a48 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -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; diff --git a/plugins/GSdx/GSTexture11.h b/plugins/GSdx/GSTexture11.h index 1f78df5f34..7a7678016b 100644 --- a/plugins/GSdx/GSTexture11.h +++ b/plugins/GSdx/GSTexture11.h @@ -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); diff --git a/plugins/GSdx/GSTextureCache11.h b/plugins/GSdx/GSTextureCache11.h index 2ab4e4766e..3b3edb5bc0 100644 --- a/plugins/GSdx/GSTextureCache11.h +++ b/plugins/GSdx/GSTextureCache11.h @@ -32,5 +32,6 @@ protected: void Read(Target* t, const GSVector4i& r); public: + virtual ~GSTextureCache11() {}; GSTextureCache11(GSRenderer* r); };