On 30/03, Lee Fallat wrote:
> Alright, sorry for all the confusion. Here is the unified patch! Be sure to
> have dejavu font installed to experience the utf8ness  ; )

Since I applied this patch a few days ago I've had Xorg grind to a halt
several times, after slowly eating up all my ram Xorg ended up in an
infinite SIGALRM loop using all available cpu cycles.
Rudimentary testing seems to suggest that attached diff solves the problem.

--
Lars
--- dwm.c       2012-05-14 00:05:11.305174201 +0200
+++ dwm-xftfix.c        2012-05-13 23:55:12.493175149 +0200
@@ -806,23 +806,27 @@
        XftColorAllocValue(dpy, DefaultVisual(dpy, screen), cmap, &color.color, 
&color);
        XftDraw *draw = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, 
screen), cmap);
 
-       if(!text)
+       if(!text) {
+               XftDrawDestroy(draw);
                return;
+       }
        olen = strlen(text);
        h = dc.font.ascent + dc.font.descent;
        y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
        x = dc.x + (h / 2);
        /* shorten text if necessary */
        for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w - h; 
len--);
-       if(!len)
+       if(!len) {
+               XftDrawDestroy(draw);
                return;
+       }
        memcpy(buf, text, len);
        if(len < olen)
                for(i = len; i && i > len - 3; buf[--i] = '.');
 
        XftDrawStringUtf8(draw, &color, dc.font.xfont, x, y, (XftChar8 *)buf, 
len);
 
-       free(draw);
+       XftDrawDestroy(draw);
 }
 
 void

Reply via email to