BUG -- Xnest 1.5 sunken by XftDrawString8()

Pat Kane pekane52 at gmail.com
Wed Oct 7 12:50:57 PDT 2009


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.

Pat
---

diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index ad9668e..8ac4aa4 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -237,6 +237,7 @@ void
 xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
                  xRectangle *pRectangles)
 {
+  if(xnestDrawable(pDrawable))
   XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
                   (XRectangle *)pRectangles, nRectangles);
 }



On Wed, Oct 7, 2009 at 3:36 AM, Eeri Kask <Eeri.Kask at inf.tu-dresden.de> wrote:
> Hello,
>
> It appears the tiny attached program crashes Xnest if the line
>
>
>        #if 0 /* halve width */
>
> is changed to
>
>        #if 1 /* halve width */
>
>
> Basically then it Xft-paints text beyond 'bounding-area' of XShape.
>
> In contrast, this program doesn't crash Xnest 1.2 and 1.3.
>
>
> Greetings,
>
>    Eeri Kask
>
>
> P.S. To prove it is XftDrawString8() problem please change
>
>        #if 1   /* enable/disable exposures */
>
> to
>
>        #if 0   /* enable/disable exposures */
>
>
> few lines below and rerun.
>
>
> /*
>    gcc -o textbitmapshape_bugdemo TextBitmapShape_BugDemo.c -lX11 -lXext -lXft  -L/usr/X11R6/lib -I/usr/X11R6/include -I/usr/X11R6/include/freetype2
> */
>
> #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);
>
>    Window win = XCreateSimpleWindow (dsp, XRootWindow (dsp, scr), 5, 5, 300, 100, 3,
>                                        XBlackPixel (dsp, scr), XWhitePixel (dsp, scr));
>    XRectangle rec;
>    rec.x = rec.y = 0;
>    rec.width = 300, rec.height = 100;
> #if 0 /* halve width */
>    rec.width -= 150;
> #endif
>    XShapeCombineRectangles (dsp, win, ShapeBounding, 0, 0, &rec, 1, ShapeSet, Unsorted);
>
>    XftColor xft_col;
>    XftColorAllocName (dsp, XDefaultVisual (dsp, scr), XDefaultColormap (dsp, scr), "SeaGreen", &xft_col);
>    XftFont * font = XftFontOpenName (dsp, scr, "serif:bold:italic:pixelsize=33");
>    XftDraw * 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
>    }
> }
>
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
>



More information about the xorg mailing list