Before destroying a current context, set some other current context (even none).

Fixes crashes with Intel.


svn path=/trunk/KDE/kdebase/workspace/; revision=731410
This commit is contained in:
Luboš Luňák 2007-10-31 16:28:59 +00:00
parent 255d9e3837
commit 6c47fc8322
2 changed files with 8 additions and 11 deletions

View file

@ -76,9 +76,7 @@ void CompositingPrefs::detect()
GLXDrawable olddrawable = glXGetCurrentDrawable();
GLXDrawable oldreaddrawable;
if( hasglx13 )
{
oldreaddrawable = glXGetCurrentReadDrawable();
}
if( createGLXContext() )
{
@ -87,8 +85,6 @@ void CompositingPrefs::detect()
deleteGLXContext();
}
if( oldcontext != NULL )
{
if( hasglx13 )
{
glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext );
@ -97,7 +93,6 @@ void CompositingPrefs::detect()
{
glXMakeCurrent( display(), olddrawable, oldcontext );
}
}
#endif
}
@ -201,7 +196,7 @@ void CompositingPrefs::applyDriverSpecificOptions()
mEnableCompositing = true;
mStrictBinding = false;
}
else if( mDriver == "intel")
else if( mDriver == "intel" )
{
kDebug() << "intel driver, disabling vsync, enabling direct";
mEnableVSync = false;

View file

@ -189,6 +189,7 @@ SceneOpenGL::~SceneOpenGL()
glXDestroyPixmap( display(), last_pixmap );
glXDestroyContext( display(), ctxdrawable );
}
glXMakeCurrent( display(), None, NULL );
glXDestroyContext( display(), ctxbuffer );
checkGLError( "Cleanup" );
}
@ -297,10 +298,11 @@ bool SceneOpenGL::initRenderingContext()
kDebug( 1212 ) << "Couldn't initialize rendering context";
return false;
}
glXMakeCurrent( display(), None, NULL );
glXDestroyContext( display(), ctxbuffer );
direct_rendering = false; // try again
ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE );
if( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer ))
if( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer ) || errs.error( true ))
{
kDebug( 1212 ) << "Couldn't initialize rendering context";
return false;