]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/glx/glcontext.cpp
Create GLContext::priv later to avoid memory leaks
[libs/gui.git] / source / graphics / glx / glcontext.cpp
index a73b9c554760af4f1c5d368b69605533c48be16f..b3d8ed0565d867e6f8ab06df0095232d81c73e04 100644 (file)
@@ -22,8 +22,6 @@ struct GLContext::Private
 
 void GLContext::platform_init(const GLOptions &opts)
 {
-       priv = new Private;
-
        vector<int> attribs;
        
        attribs.push_back(GLX_RGBA);
@@ -60,6 +58,8 @@ void GLContext::platform_init(const GLOptions &opts)
        XVisualInfo *vi = glXChooseVisual(dpy, DefaultScreen(dpy), &attribs.front());
        if(!vi)
                throw unsupported_gl_mode(opts);
+
+       priv = new Private;
        priv->context = glXCreateContext(dpy, vi, 0, true);
 
        XSetWindowAttributes attr;