diff options
author | Adam Jackson <ajax@redhat.com> | 2011-03-28 12:30:09 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2011-04-15 12:55:47 -0400 |
commit | 6a433b67ca15fd1ea58334e607f867554f227451 (patch) | |
tree | e7b7983482d4f84672ad81d2497e2cb776e6a001 /glx/glxcmds.c | |
parent | b3d2164a0361f636bfe77b51456bee9213af4f13 (diff) |
glx: Fix lifetime tracking for pixmaps
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.
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx/glxcmds.c')
-rw-r--r-- | glx/glxcmds.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 66d4c7e16..d5b764fd0 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1127,10 +1127,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)) { pGlxDraw->destroy (pGlxDraw); return BadAlloc; @@ -1161,6 +1162,8 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId, glxDrawableId, GLX_DRAWABLE_PIXMAP); + ((PixmapPtr)pDraw)->refcnt++; + return err; } |