From 52f86e4a4737a8cf04df8ea687ee4b5e3619ecd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 22 Jan 2008 17:04:41 +0000 Subject: [PATCH] The context should probably be first unset from being current, and also fix a possible leak. svn path=/trunk/KDE/kdebase/workspace/; revision=764823 --- compositingprefs.cpp | 14 ++++++-------- compositingprefs.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/compositingprefs.cpp b/compositingprefs.cpp index e5c24dc3bb..a4698c6251 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -133,27 +133,23 @@ void CompositingPrefs::detect() if( hasglx13 ) oldreaddrawable = glXGetCurrentReadDrawable(); - if( createGLXContext() ) + if( initGLXContext() ) { detectDriverAndVersion(); applyDriverSpecificOptions(); - - deleteGLXContext(); } if( hasglx13 ) - { glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext ); - } else - { glXMakeCurrent( display(), olddrawable, oldcontext ); - } + deleteGLXContext(); #endif } -bool CompositingPrefs::createGLXContext() +bool CompositingPrefs::initGLXContext() { #ifdef KWIN_HAVE_OPENGL_COMPOSITING + mGLContext = NULL; KXErrorHandler handler; // Most of this code has been taken from glxinfo.c QVector attribs; @@ -204,6 +200,8 @@ bool CompositingPrefs::createGLXContext() void CompositingPrefs::deleteGLXContext() { #ifdef KWIN_HAVE_OPENGL_COMPOSITING + if( mGLContext == NULL ) + return; glXDestroyContext( display(), mGLContext ); XDestroyWindow( display(), mGLWindow ); #endif diff --git a/compositingprefs.h b/compositingprefs.h index b73a6a99cd..73155a0ee9 100644 --- a/compositingprefs.h +++ b/compositingprefs.h @@ -70,7 +70,7 @@ protected: void applyDriverSpecificOptions(); static bool detectXgl(); - bool createGLXContext(); + bool initGLXContext(); void deleteGLXContext();