]> git.tdb.fi Git - libs/gui.git/blobdiff - source/glcontext.cpp
Plug some memory leaks
[libs/gui.git] / source / glcontext.cpp
index 599538429e2e6ba27f65c109038727bd0fc725c2..9377e888a8b977133ce82f915afd5bcf4ec599e1 100644 (file)
@@ -65,9 +65,17 @@ GLContext::GLContext(Display &d, const GLOptions &opts):
 
        window=XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1024, 768, 0, vi->depth, InputOutput, vi->visual, CWColormap, &attr);
 
+       XFree(vi);
+
        glXMakeCurrent(dpy, window, context);
 }
 
+GLContext::~GLContext()
+{
+       glXDestroyContext(display.get_display(), context);
+       XDestroyWindow(display.get_display(), window);
+}
+
 void GLContext::attach(Window &wnd)
 {
        XReparentWindow(display.get_display(), window, wnd.get_handle(), 0, 0);