tag 312140 patch
thanks

Hey,

the problem here is caused by the fact that KDE loads a bunch of
X resources and some use the hexadecimal representation for colors
instead of their name. XWatch finds these resources when looking for
the background and foreground colors.

The code that translates the name into RGB values can't handle the
hexadecimal #rrggbb format so it tries to do a warning(). But since
this all happens before create_the_forms() has run there is no window
to print the warning in, and so there is a segfault in addline().

The attached patches fix these problems. xwatch-hexcolors.diff teaches
colorname2rgb() about #rrggbb and xwatch-uninitialized_watch_browser.diff
prints lines to stderr if there is no window yet.

Regards,

-- 
Göran Weinholt <[EMAIL PROTECTED]>
Debian developer, sysadmin, netadmin
--- xwatch-2.11/src/colorname2rgb.c~    2005-08-06 03:53:55.000000000 +0200
+++ xwatch-2.11/src/colorname2rgb.c     2005-08-06 03:57:04.000000000 +0200
@@ -45,6 +45,14 @@
     if (! name || ! *name)                      /* need a real name arg */
         return (0);
     
+    if (sscanf (name, "#%02x%02x%02x", &red, &green, &blue) == 3)
+    {
+        *r = red;
+        *g = green;
+        *b = blue;
+        return (1);
+    }
+           
     if (! (fp = fopen(RGB_FILE, "r")) )         /* open database file */
     {
         warning ("Cannot read RGB database %s", RGB_FILE);
--- xwatch-2.11/src/addline.c~  2005-08-06 03:54:52.000000000 +0200
+++ xwatch-2.11/src/addline.c   2005-08-06 03:58:38.000000000 +0200
@@ -55,6 +55,11 @@
         if (strstr (buf, gagstring [i]))
             return;
 
+    if (!watch_browser) {
+        fprintf(stderr, "%s\n", buf);
+        return;
+    }
+       
     /* determine width to use */
     fl_get_browser_dimension (watch_browser, &curx, &cury, 
         &curwidth, &curheight);

Attachment: signature.asc
Description: Digital signature

Reply via email to