summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2013-01-26 15:05:51 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2013-01-30 09:45:21 (GMT)
commit77f388ba468f88c54a51f2a1407799a6f5c69cca (patch)
tree85c8ea4c5d9eeca60ef89dac933889c06dc9ff71
parent5bcb0f7b97c571969f8e0431ea677428a8546f88 (diff)
Initialize some variables and check on destruction
BUG: 313911 REVIEW: 108604
-rw-r--r--kwin/glxbackend.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/kwin/glxbackend.cpp b/kwin/glxbackend.cpp
index 627812f..be11497 100644
--- a/kwin/glxbackend.cpp
+++ b/kwin/glxbackend.cpp
@@ -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");
}