The context should probably be first unset from being current,

and also fix a possible leak.


svn path=/trunk/KDE/kdebase/workspace/; revision=764823
This commit is contained in:
Luboš Luňák 2008-01-22 17:04:41 +00:00
parent cd8e69aff3
commit 52f86e4a47
2 changed files with 7 additions and 9 deletions

View file

@ -133,27 +133,23 @@ void CompositingPrefs::detect()
if( hasglx13 ) if( hasglx13 )
oldreaddrawable = glXGetCurrentReadDrawable(); oldreaddrawable = glXGetCurrentReadDrawable();
if( createGLXContext() ) if( initGLXContext() )
{ {
detectDriverAndVersion(); detectDriverAndVersion();
applyDriverSpecificOptions(); applyDriverSpecificOptions();
deleteGLXContext();
} }
if( hasglx13 ) if( hasglx13 )
{
glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext ); glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext );
}
else else
{
glXMakeCurrent( display(), olddrawable, oldcontext ); glXMakeCurrent( display(), olddrawable, oldcontext );
} deleteGLXContext();
#endif #endif
} }
bool CompositingPrefs::createGLXContext() bool CompositingPrefs::initGLXContext()
{ {
#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGL_COMPOSITING
mGLContext = NULL;
KXErrorHandler handler; KXErrorHandler handler;
// Most of this code has been taken from glxinfo.c // Most of this code has been taken from glxinfo.c
QVector<int> attribs; QVector<int> attribs;
@ -204,6 +200,8 @@ bool CompositingPrefs::createGLXContext()
void CompositingPrefs::deleteGLXContext() void CompositingPrefs::deleteGLXContext()
{ {
#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGL_COMPOSITING
if( mGLContext == NULL )
return;
glXDestroyContext( display(), mGLContext ); glXDestroyContext( display(), mGLContext );
XDestroyWindow( display(), mGLWindow ); XDestroyWindow( display(), mGLWindow );
#endif #endif

View file

@ -70,7 +70,7 @@ protected:
void applyDriverSpecificOptions(); void applyDriverSpecificOptions();
static bool detectXgl(); static bool detectXgl();
bool createGLXContext(); bool initGLXContext();
void deleteGLXContext(); void deleteGLXContext();