[Mesa-dev] [PATCH] Fix for throwing BadDrawable (invalid Pixmap or Window parameter) by Xserver

Ian Romanick idr at freedesktop.org
Wed Sep 4 10:08:55 PDT 2013


The explanatory text from the mangled version of the patch should be
included here as well.

Can you give some more explanation of how this can occur?  I'd like to
have a piglit test.  Looking at the documentation for glXUseXFont, there
needs to be a valid context bound, and there is some commentary about
invalid windows:

    "GLXBadCurrentWindow is generated if the drawable associated
    with the current context of the calling thread is a window,
    and that window is no longer valid."

Also, this seems related to

https://bugs.freedesktop.org/show_bug.cgi?id=56922

and possibly

https://bugs.freedesktop.org/show_bug.cgi?id=54080

Perhaps the reporters of those bugs (added to CC) can comment on whether
this change fixes their bugs.

On 09/04/2013 09:40 AM, Lukasz Maniak wrote:
> Signed-off-by: Lukasz Maniak <lukasz.maniak at intel.com>
> ---
>  src/glx/xfont.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glx/xfont.c b/src/glx/xfont.c
> index 316c585..60e28ab 100644
> --- a/src/glx/xfont.c
> +++ b/src/glx/xfont.c
> @@ -215,7 +215,6 @@ _X_HIDDEN void
>  DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int listbase)
>  {
>     Display *dpy;
> -   Window win;
>     Pixmap pixmap;
>     GC gc;
>     XGCValues values;
> @@ -231,7 +230,6 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
>     int i;
>  
>     dpy = CC->currentDpy;
> -   win = CC->currentDrawable;
>  
>     fs = XQueryFont(dpy, font);
>     if (!fs) {
> @@ -279,7 +277,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
>     glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
>     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
>  
> -   pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
> +   pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), 10, 10, 1);
>     values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
>     values.background = WhitePixel(dpy, DefaultScreen(dpy));
>     values.font = fs->fid;
> @@ -342,7 +340,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
>        if (valid && (bm_width > 0) && (bm_height > 0)) {
>  
>           memset(bm, '\0', bm_width * bm_height);
> -         fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
> +         fill_bitmap(dpy, DefaultRootWindow(dpy), gc, bm_width, bm_height, x, y, c, bm);
>  
>           glBitmap(width, height, x0, y0, dx, dy, bm);
>  #ifdef DEBUG
> 



More information about the mesa-dev mailing list