]> git.tdb.fi Git - libs/gui.git/commitdiff
Plug some memory leaks
authorMikko Rasa <tdb@tdb.fi>
Fri, 28 Dec 2007 20:05:18 +0000 (20:05 +0000)
committerMikko Rasa <tdb@tdb.fi>
Fri, 28 Dec 2007 20:05:18 +0000 (20:05 +0000)
source/display.cpp
source/glcontext.cpp
source/glcontext.h

index b8e4fbe6119e1ea93645d4fbad9476b080c88040..ba5a6402c4196f937d5ddc689b577813325a8c2f 100644 (file)
@@ -73,6 +73,8 @@ Display::Display(const string &disp_name)
                modes.push_back(mode);
        }
 
+       XFree(infos);
+
        XF86VidModeModeLine modeline;
        int dotclock;
        XF86VidModeGetModeLine(display, screen, &dotclock, &modeline);
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);
index 1156b53aee112e7fd3ad50a69b7a41081b1e592e..f9e5f4696d9aab3cebeceed67be72049d0eeda5a 100644 (file)
@@ -38,6 +38,8 @@ private:
 
 public:
        GLContext(Display &dpy, const GLOptions &opts);
+       ~GLContext();
+
        void attach(Window &wnd);
        void swap_buffers();
 private: