Commit 59b9c3d5 authored by Julien Cristau's avatar Julien Cristau Committed by Adam Jackson
Browse files

glx: don't call pGlxDraw->destroy() if AddResource fails



AddResource will have called DrawableGone, which takes care of the
destruction.
Reviewed-by: default avatarRémi Cardona <remi@gentoo.org>
Signed-off-by: Julien Cristau's avatarJulien Cristau <jcristau@debian.org>
parent ac97fb2b
...@@ -544,7 +544,6 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client, ...@@ -544,7 +544,6 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
/* since we are creating the drawablePrivate, drawId should be new */ /* since we are creating the drawablePrivate, drawId should be new */
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) { if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
pGlxDraw->destroy(pGlxDraw);
*error = BadAlloc; *error = BadAlloc;
return NULL; return NULL;
} }
...@@ -1239,20 +1238,16 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen, ...@@ -1239,20 +1238,16 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen,
if (pGlxDraw == NULL) if (pGlxDraw == NULL)
return BadAlloc; return BadAlloc;
if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw)) { if (!AddResource(glxDrawableId, __glXDrawableRes, pGlxDraw))
pGlxDraw->destroy(pGlxDraw);
return BadAlloc; return BadAlloc;
}
/* /*
* Windows aren't refcounted, so track both the X and the GLX window * Windows aren't refcounted, so track both the X and the GLX window
* so we get called regardless of destruction order. * so we get called regardless of destruction order.
*/ */
if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW && if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) { !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw))
pGlxDraw->destroy(pGlxDraw);
return BadAlloc; return BadAlloc;
}
return Success; return Success;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment