]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/wgl/glcontext.cpp
Create GLContext::priv later to avoid memory leaks
[libs/gui.git] / source / graphics / wgl / glcontext.cpp
index 964dea2b7fba92a66815b7d84e89254c0c840880..05f9533de839322057b6b896eb8bc0cfabd3636d 100644 (file)
@@ -16,8 +16,6 @@ struct GLContext::Private
 
 void GLContext::platform_init(const GLOptions &opts)
 {
-       priv = new Private;
-
        HDC dc = GetDC(window.get_private().window);
 
        PIXELFORMATDESCRIPTOR pfd;
@@ -40,6 +38,7 @@ void GLContext::platform_init(const GLOptions &opts)
                throw unsupported_gl_mode(opts);
        SetPixelFormat(dc, pf_index, &pfd);
 
+       priv = new Private;
        priv->context = wglCreateContext(dc);
        wglMakeCurrent(dc, priv->context);