summaryrefslogtreecommitdiff
path: root/platform/x11/context_gl_x11.cpp
diff options
context:
space:
mode:
authorOkam Studio <juan@okamstudio.com>2015-10-25 16:03:02 -0300
committerOkam Studio <juan@okamstudio.com>2015-10-25 16:03:02 -0300
commit8949db75c3a3c30b5ffd4d8c177970306e4619a9 (patch)
tree3d3a554e6654aa9c13fcf7995c113d0620075a07 /platform/x11/context_gl_x11.cpp
parent4baf65dab78b6e8062de760010338c316c628394 (diff)
parent2d2ab92680cdc30fa1bfb192adaa89ef50dcb857 (diff)
Merge pull request #2677 from phobos-tro/x11-memleak
X11 -- Fixing memleaks
Diffstat (limited to 'platform/x11/context_gl_x11.cpp')
-rw-r--r--platform/x11/context_gl_x11.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index dc0dc063b9..3db1f6da25 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -46,7 +46,6 @@ struct ContextGL_X11_Private {
::GLXContext glx_context;
};
-
void ContextGL_X11::release_current() {
glXMakeCurrent(x11_display, None, NULL);
@@ -56,10 +55,12 @@ void ContextGL_X11::make_current() {
glXMakeCurrent(x11_display, x11_window, p->glx_context);
}
+
void ContextGL_X11::swap_buffers() {
glXSwapBuffers(x11_display,x11_window);
}
+
/*
static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) {
@@ -154,6 +155,9 @@ Error ContextGL_X11::initialize() {
*/
//glXMakeCurrent(x11_display, None, NULL);
+ XFree( vi );
+ XFree( fbc );
+
return OK;
}
@@ -164,12 +168,12 @@ int ContextGL_X11::get_window_width() {
return xwa.width;
}
+
int ContextGL_X11::get_window_height() {
XWindowAttributes xwa;
XGetWindowAttributes(x11_display,x11_window,&xwa);
return xwa.height;
-
}
@@ -189,6 +193,8 @@ ContextGL_X11::ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,con
ContextGL_X11::~ContextGL_X11() {
+ release_current();
+ glXDestroyContext( x11_display, p->glx_context );
memdelete( p );
}