[hackers] [wmii] Make sure a window has a visual before dereferencing it. Fixes issue #195. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Mon, 21 Jun 2010 14:31:49 +0000 (UTC)

changeset: 2739:e1846008ed75
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Mon Jun 21 10:29:51 2010 -0400
files: lib/libstuff/x11/colors/parsecolor.c lib/libstuff/x11/initdisplay.c
description:
Make sure a window has a visual before dereferencing it. Fixes issue #195.

diff -r 1b00b9223ab2 -r e1846008ed75 lib/libstuff/x11/colors/parsecolor.c
--- a/lib/libstuff/x11/colors/parsecolor.c Sun Jun 20 16:37:17 2010 -0400
+++ b/lib/libstuff/x11/colors/parsecolor.c Mon Jun 21 10:29:51 2010 -0400
@@ -7,7 +7,7 @@
 pixelvalue(Window *w, Color *c) {
         XColor xc;
 
- if(w->visual->class != TrueColor) {
+ if(w->visual == nil || w->visual->class != TrueColor) {
                 if(c->pixel != ~0UL)
                         return c->pixel;
                 xc.red = c->red;
diff -r 1b00b9223ab2 -r e1846008ed75 lib/libstuff/x11/initdisplay.c
--- a/lib/libstuff/x11/initdisplay.c Sun Jun 20 16:37:17 2010 -0400
+++ b/lib/libstuff/x11/initdisplay.c Mon Jun 21 10:29:51 2010 -0400
@@ -68,6 +68,7 @@
         scr.depth = DefaultDepth(display, scr.screen);
 
         scr.root.xid = RootWindow(display, scr.screen);
+ scr.root.visual = scr.visual;
         scr.root.r = Rect(0, 0,
                           DisplayWidth(display, scr.screen),
                           DisplayHeight(display, scr.screen));
Received on Mon Jun 21 2010 - 14:31:49 UTC

This archive was generated by hypermail 2.2.0 : Mon Jun 21 2010 - 14:36:05 UTC