From cd2eedd0f2a2e8093d7dd5b936bf81a7b9cf8d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 26 Jan 2013 16:05:51 +0100 Subject: [PATCH] Initialize some variables and check on destruction BUG: 313911 REVIEW: 108604 FIXED-IN: 4.10 --- glxbackend.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/glxbackend.cpp b/glxbackend.cpp index 627812fee4..be1149780c 100644 --- a/glxbackend.cpp +++ b/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"); }