[PATCH] glx: Fix lifetime tracking for pixmaps

Michel Dänzer michel at daenzer.net
Tue Mar 29 01:09:31 PDT 2011


On Mon, 2011-03-28 at 12:40 -0400, Adam Jackson wrote: 
> GLX pixmaps take a reference on the underlying pixmap; X and GLX pixmap
> IDs can be destroyed in either order with no error.  Only windows need
> to be tracked under both XIDs.
> 
> Fixes piglit/glx-pixmap-life.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  glx/glxcmds.c |   11 +++++++----
>  glx/glxext.c  |   22 +++++++++++++---------
>  2 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/glx/glxcmds.c b/glx/glxcmds.c
> index 9b4bc9e..9d60bdb 100644
> --- a/glx/glxcmds.c
> +++ b/glx/glxcmds.c
> @@ -1177,10 +1177,11 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
>  	return BadAlloc;
>      }
>  
> -    /* Add the glx drawable under the XID of the underlying X drawable
> -     * too.  That way we'll get a callback in DrawableGone and can
> -     * clean up properly when the drawable is destroyed. */
> -    if (drawableId != glxDrawableId &&
> +    /*
> +     * Windows aren't refcounted, so track both the X and the GLX window
> +     * so we get called regardless of destruction order.
> +     */
> +    if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
>  	!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {

Is pDraw->id == drawableId always true here for windows? That was one of
the issues previously proposed fixes in this area were trying to
address.

Looks good otherwise though.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-devel mailing list