From 276d8057aa7f6e36c9c874257a6383f416c5cedd Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 3 Aug 2013 09:47:55 -0400 Subject: glx: Fix memory leak in context garbage collection (v2) I broke this, back in: commit a48dadc98a28c969741979b70b7a639f24f4cbbd Author: Adam Jackson Date: Mon Mar 21 11:59:29 2011 -0400 glx: Reimplement context tags In that, I changed the glx client state to not explicitly track the list of current contexts for the client (since that was what we were deriving tags from). The bug was that I removed the code for same from glxClientCallback without noticing that it had the side effect of effectively de-currenting those contexts, so that ContextGone could free them. So, if you had a client exit with a context still current, the context's memory would leak. Not a huge deal for direct clients, but viciously bad for indirect, since the swrast context state at the bottom of Mesa is like 15M. Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that we have a back-pointer to chase when walking the list of contexts when ClientStateGone happens. v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our current context might be one we got from EXT_import_context and whose creating client has since died. Without the explicit call, the creating client's FreeClientResources would not free the context because it's still current, and the using client's FreeClientResources would not free the context because it's not an XID it created. This matches the logic from a48dadc. Reviewed-by: Ian Romanick Signed-off-by: Adam Jackson --- glx/createcontext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'glx/createcontext.c') diff --git a/glx/createcontext.c b/glx/createcontext.c index 13d21ccb9..78792dab6 100644 --- a/glx/createcontext.c +++ b/glx/createcontext.c @@ -320,7 +320,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) ctx->id = req->context; ctx->share_id = req->shareList; ctx->idExists = True; - ctx->isCurrent = False; + ctx->currentClient = False; ctx->isDirect = req->isDirect; ctx->hasUnflushedCommands = False; ctx->renderMode = GL_RENDER; -- cgit v1.2.1