Initialize some variables and check on destruction

BUG: 313911
REVIEW: 108604
This commit is contained in:
Thomas Lübking 2013-01-26 16:05:51 +01:00
parent a7066aa3e2
commit 69b2804a12

View file

@ -40,7 +40,13 @@ namespace KWin
{
GlxBackend::GlxBackend()
: OpenGLBackend()
, gcroot(None)
, buffer(None)
, fbcbuffer_db(NULL)
, fbcbuffer_nondb(NULL)
, fbcbuffer(NULL)
, glxbuffer(None)
, ctxbuffer(None)
, haveSwapInterval(false)
{
init();
@ -52,16 +58,21 @@ GlxBackend::~GlxBackend()
// do cleanup after initBuffer()
cleanupGL();
glXMakeCurrent(display(), None, NULL);
glXDestroyContext(display(), ctxbuffer);
if (ctxbuffer)
glXDestroyContext(display(), ctxbuffer);
if (overlayWindow()->window()) {
if (hasGLXVersion(1, 3))
if (hasGLXVersion(1, 3) && glxbuffer)
glXDestroyWindow(display(), glxbuffer);
XDestroyWindow(display(), buffer);
if (buffer)
XDestroyWindow(display(), buffer);
overlayWindow()->destroy();
} else {
glXDestroyPixmap(display(), glxbuffer);
XFreeGC(display(), gcroot);
XFreePixmap(display(), buffer);
if (glxbuffer)
glXDestroyPixmap(display(), glxbuffer);
if (gcroot)
XFreeGC(display(), gcroot);
if (buffer)
XFreePixmap(display(), buffer);
}
checkGLError("Cleanup");
}