[Mesa-dev] [PATCH] xlib: handle _mesa_initialize_visual()'s return value
Ian Romanick
idr at freedesktop.org
Wed Jan 2 10:52:34 PST 2013
On 12/26/2012 03:28 PM, Brian Paul wrote:
> From: Brian Paul <brianp at vmware.com>
>
> If the call fails, we should return NULL from XMesaCreateVisual().
> This was found when Waffle tried to create a visual with depth/stencil
> bits = -1. That's an illegal value for glXChooseFBConfig() and we should
Isn't -1 == GLX_DONT_CARE? If it's truly invalid, shouldn't it have
been caught (and rejected) before this point?
> return NULL in that situation.
>
> Note: This is a candidate for the stable branches.
> ---
> src/mesa/drivers/x11/xm_api.c | 21 ++++++++++++---------
> 1 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
> index 8105f4d..2ba65ff 100644
> --- a/src/mesa/drivers/x11/xm_api.c
> +++ b/src/mesa/drivers/x11/xm_api.c
> @@ -847,15 +847,18 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
> alpha_bits = v->mesa_visual.alphaBits;
> }
>
> - _mesa_initialize_visual( &v->mesa_visual,
> - db_flag, stereo_flag,
> - red_bits, green_bits,
> - blue_bits, alpha_bits,
> - depth_size,
> - stencil_size,
> - accum_red_size, accum_green_size,
> - accum_blue_size, accum_alpha_size,
> - 0 );
> + if (!_mesa_initialize_visual(&v->mesa_visual,
> + db_flag, stereo_flag,
> + red_bits, green_bits,
> + blue_bits, alpha_bits,
> + depth_size,
> + stencil_size,
> + accum_red_size, accum_green_size,
> + accum_blue_size, accum_alpha_size,
> + 0)) {
> + FREE(v);
> + return NULL;
> + }
>
> /* XXX minor hack */
> v->mesa_visual.level = level;
>
More information about the mesa-dev
mailing list