BUG -- Xnest 1.5 sunken by XftDrawString8()

Pat Kane pekane52 at gmail.com
Thu Oct 8 11:22:54 PDT 2009


On Thu, Oct 8, 2009 at 10:42 AM, Eeri Kask <Eeri.Kask at inf.tu-dresden.de> wrote:
> Am 10/07/2009 09:50 PM, Pat Kane schrieb:
>> On Wed, Oct 7, 2009 at 3:36 AM, Eeri Kask <Eeri.Kask at inf.tu-dresden.de> wrote:
>>> It appears the tiny attached program crashes Xnest if the lin
>>
>> Here is a patch to workaround the problem.
>
> Thanks again, this patch definitely solved the crash issue.
>

Note that the patch only prevents  the XFillRectangles case from
killing Xnest, there are lots of other places where a NULL pDrawable
could cause problems (e.g. xnestFillPolygon, xnestPolyText8 ...)

> Though, may I kindly attach another variation of that small program
> which now disclosed another problem, probably related to ... I don't
> yet know.  :-)
>
> Running on a usual X11-server (I just installed and test on "X.Org X
> Server 1.6.3.901 (1.6.4 RC 1)") this program draws a small text with
> a two-pixel *white* outline which is created by XShape.  Now running
> on Xnest, parts of this white outline appear *black*.  If exposures
> are turned off by "#if 0", the background-shape appears all white.

Yeah, I see that problem here too.  It maybe be related to the bogus
nature of the workaround I gave you -- the correct fix would be to
prevent Xnest from generating a NULL pDrawable pointer.

> As these outline defects now apparently appear with Xnest 1.2.0 and
> 1.3.0 too running ontop of "1.6.4-rc1" it maybe is a problem of the
> latter?
>
> I don't know if you can do anything about it, I simply wanted to let
> you know.
>
> Thanks for your time,
>
>    Eeri Kask
>
>
> /*
>    gcc -o textbitmapshape TextBitmapShape.c -lX11 -lXext -lXft  -L/usr/X11R6/lib -I/usr/X11R6/include -I/usr/X11R6/include/freetype2
> */
>
> #include <stdio.h>
> #include <X11/Xlib.h>
> #include <X11/Xft/Xft.h>
> #include <X11/extensions/shape.h>
>
> main (int argc, char **argv)
> {
>    char * str = (argc>1?argv[1]:"Lorem ipsum");
>
>    Display * dsp = XOpenDisplay (NULL);
>    int scr = XDefaultScreen (dsp);
>
>    XftDraw * draw;
>    XftColor xft_col;
>    XftColorAllocName (dsp, XDefaultVisual (dsp, scr), XDefaultColormap (dsp, scr), "SeaGreen", &xft_col);
>    XftFont * font = XftFontOpenName (dsp, scr, "serif:bold:italic:pixelsize=33");
>
>    Window win = XCreateSimpleWindow (dsp, XRootWindow (dsp, scr), 5, 5, 300, 100, 3,
>                                        XBlackPixel (dsp, scr), XWhitePixel (dsp, scr));
>
>    XRectangle rec;
>    rec.x = rec.y = 3;
>    rec.width = 300-6;
>    rec.height = 100-6;
>    XShapeCombineRectangles (dsp, win, ShapeBounding, 0, 0, &rec, 1, ShapeSubtract, Unsorted);
>
>    Pixmap mask = XCreatePixmap (dsp, XRootWindow (dsp, scr), 300, 100, 1);
>    GC gc = XCreateGC (dsp, mask, 0, NULL);
>    XSetForeground (dsp, gc, 0);
>    XFillRectangle (dsp, mask, gc, 0, 0, 300, 100);
>
>    draw = XftDrawCreateBitmap (dsp, mask);
>    XftDrawString8 (draw, &xft_col, font, 20, 60, (XftChar8*)(str), strlen(str));
>    XftDrawDestroy (draw);
>
>    XSetFunction (dsp, gc, GXor);
>    int i;
>    for (i = 1; i <= 2; ++i)
>    {
>        XCopyArea (dsp, mask, mask, gc, 1, 0, 299, 100, 0, 0);
>        XCopyArea (dsp, mask, mask, gc, 0, 0, 299, 100, 1, 0);
>        XCopyArea (dsp, mask, mask, gc, 0, 1, 300,  99, 0, 0);
>        XCopyArea (dsp, mask, mask, gc, 0, 0, 300,  99, 0, 1);
>    }
>    XFreeGC (dsp, gc);
>
>    XShapeCombineMask (dsp, win, ShapeBounding, 0, 0, mask, ShapeUnion);
>    XFreePixmap (dsp, mask);
>
>    draw = XftDrawCreate (dsp, win, XDefaultVisual (dsp, scr), XDefaultColormap (dsp, scr));
>
>    XSelectInput (dsp, win, ExposureMask);
>    XMapWindow (dsp, win);
>
>    for (;;)
>    {
>        XEvent evt;
>        XNextEvent (dsp, &evt);
> #if 1   /* enable/disable exposures */
>        if (evt.type == Expose)
>            XftDrawString8 (draw, &xft_col, font, 20, 60, (XftChar8*)(str), strlen(str));
> #endif
>    }
> }
>
>



More information about the xorg mailing list