gsdx ogl: fix crash when pause/resume with EGL (opensource driver)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5690 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2013-06-30 15:27:50 +00:00
parent ba20bb0258
commit 91d39de645
3 changed files with 24 additions and 16 deletions

View File

@ -360,6 +360,13 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
s_gs->SetMultithreaded(true);
#ifdef _LINUX
if (s_gs->m_wnd) {
// A window was already attached to s_gs so we also
// need to restore the window state (Attach)
s_gs->m_wnd->Attach((void*)((uint32*)(dsp)+1), false);
} else {
// No window found, try to attach a GLX win and retry
// with EGL win if failed.
for(uint32 i = 0; i < 2; i++) {
try
{
@ -378,6 +385,7 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
delete wnd[i];
}
}
}
if (s_gs->m_wnd == NULL)
{
return -1;

View File

@ -267,6 +267,7 @@ void GSWndEGL::HideFrame()
void GSWndEGL::CloseEGLDisplay()
{
eglReleaseThread();
eglTerminate(m_eglDisplay);
}

View File

@ -63,8 +63,6 @@ void GSWndOGL::CreateContext(int major, int minor)
if (!fbc || fbcount < 1) {
throw GSDXRecoverableError();
}
XFree(fbc);
GLXFBConfig fbc_cp = fbc[0];
PFNGLXCREATECONTEXTATTRIBSARBPROC glX_CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*) "glXCreateContextAttribsARB");
if (!glX_CreateContextAttribsARB) {
@ -88,7 +86,8 @@ void GSWndOGL::CreateContext(int major, int minor)
None
};
m_context = glX_CreateContextAttribsARB(m_NativeDisplay, fbc_cp, 0, true, context_attribs);
m_context = glX_CreateContextAttribsARB(m_NativeDisplay, fbc[0], 0, true, context_attribs);
XFree(fbc);
// Don't forget to reinstall the older Handler
XSetErrorHandler(oldHandler);