[PATCH] glx: Fix lifetime tracking for pixmaps

Michel Dänzer michel at daenzer.net
Tue Mar 29 23:53:32 PDT 2011


On Die, 2011-03-29 at 09:48 -0400, Adam Jackson wrote: 
> On Tue, 2011-03-29 at 10:09 +0200, Michel Dänzer wrote:
> > On Mon, 2011-03-28 at 12:40 -0400, Adam Jackson wrote: 
> > > 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.
> 
> Yes.  This is only called for windows from the CreateWindow path:
> 
>     err = dixLookupDrawable(&pDraw, req->window, client, 0,
> DixAddAccess);
>     /* ... */
>     return DoCreateGLXDrawable(client, pGlxScreen, config,
>                                pDraw, req->window,
>                                req->glxwindow, GLX_DRAWABLE_WINDOW);
> 
> However it would probably be clearer to change it to be drawableId for
> symmetry with the AddResource call immediately above.

Probably, but

Reviewed-by: Michel Dänzer <michel at daenzer.net>

either way.

So, is this expected to fix the same bugs the previous reference
counting patches were supposed to, and possibly more?


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


More information about the xorg-devel mailing list