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,22 +360,30 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
s_gs->SetMultithreaded(true);
#ifdef _LINUX
for(uint32 i = 0; i < 2; i++) {
try
{
if (wnd[i] == NULL) continue;
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
{
if (wnd[i] == NULL) continue;
wnd[i]->Attach((void*)((uint32*)(dsp)+1), false);
s_gs->m_wnd = wnd[i];
wnd[i]->Attach((void*)((uint32*)(dsp)+1), false);
s_gs->m_wnd = wnd[i];
if (i == 0) delete wnd[1];
if (i == 0) delete wnd[1];
break;
}
catch (GSDXRecoverableError)
{
wnd[i]->Detach();
delete wnd[i];
break;
}
catch (GSDXRecoverableError)
{
wnd[i]->Detach();
delete wnd[i];
}
}
}
if (s_gs->m_wnd == NULL)

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);