Comment 4 for bug 1734304

Revision history for this message
GunChleoc (gunchleoc) wrote :

tl;dr: #1 is not our bug.

I have done some digging and came up with this:

https://stackoverflow.com/questions/10065849/memory-leak-using-glxcreatecontext

> Checking the docs, on glXChooseFBConfig (https://www.opengl.org/sdk/docs/man2/xhtml/glXChooseFBConfig.xml) the return value is expected to be freed with XFree called on it.

==============================

WIDELANDS:

We trigger this function once from Graphic::initialize and store the SDL_GLContext in gl_context_.

On shutdown, in Graphic::~Graphic(), we call:

    SDL_GL_DeleteContext(gl_context_);

So, we are doing everything right.

==============================

SDL2:

I found this in the SDL2 source code for it:

    void X11_GL_DeleteContext(_THIS, SDL_GLContext context)
    {
        Display *display = ((SDL_VideoData *) _this->driverdata)->display;
        GLXContext glx_context = (GLXContext) context;

        if (!_this->gl_data) {
            return;
        }
        _this->gl_data->glXDestroyContext(display, glx_context);
        X11_XSync(display, False);
    }

glXDestroyContext is documented here:

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXDestroyContext.xml

No idea if that calls XFree or not - I guess we have to dig into libmesa next to see if we can file a bug with them.