gsdx: try to protect more code when togging f9

deassert gsopen_done before delete the gs object. Compiler and CPU will
reordonate the store (or not because it is a global variable). Probably not
perfect but better.

Got a crash on GSKeyEvent which I guess wasn't thread safe. So let's ensure
gs is open.
This commit is contained in:
Gregory Hainaut 2014-06-13 23:32:50 +02:00
parent cdba010794
commit 9ac9307b44
1 changed files with 6 additions and 5 deletions

View File

@ -148,6 +148,8 @@ EXPORT_C_(int) GSinit()
EXPORT_C GSshutdown()
{
gsopen_done = false;
delete s_gs;
s_gs = NULL;
@ -164,12 +166,12 @@ EXPORT_C GSshutdown()
}
#endif
gsopen_done = false;
}
EXPORT_C GSclose()
{
gsopen_done = false;
if(s_gs == NULL) return;
s_gs->ResetDevice();
@ -184,8 +186,6 @@ EXPORT_C GSclose()
{
s_gs->m_wnd->Detach();
}
gsopen_done = false;
}
static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
@ -681,7 +681,8 @@ EXPORT_C GSkeyEvent(GSKeyEventData* e)
{
try
{
s_gs->KeyEvent(e);
if (gsopen_done)
s_gs->KeyEvent(e);
}
catch (GSDXRecoverableError)
{