Initialize some variables and check on destruction

BUG: 313911
REVIEW: 108604
FIXED-IN: 4.10
This commit is contained in:
Thomas Lübking 2013-01-26 16:05:51 +01:00
parent 0ac1950ddc
commit cd2eedd0f2

View file

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