clone 637067 -1
reassign -1 libgtk-3-0
retitle -1 gtk_tray_icon_get_visual_property may segfault
tags -1 + patch
forwarded -1 https://bugzilla.gnome.org/show_bug.cgi?id=649588
block 637067 by -1
thanks

Hi!

After   some   digging,   I   have   located  the   culprit.   this   is
gtk_tray_icon_get_visual_property()  function  that  segfault  when  the
visual is NULL.  Attached is a simple patch  (forwarded upstream) fixing
this issue.

I  clone this  bug  and attach  the  clone to  libgtk-3-0.  I leave  the
original bug report open to ensure it is easy to find.

I am no  X expert, so I don't  know if it is normal if  the condition in
gtk_tray_icon_get_visual_property()  to  have   a  non  NULL  visual  is
false.  Maybe  there  is  another  problem. However,  with  this  patch,
notification-daemon works fine. Please, apply it.

>From 6aab437e6d992a917716de88ccaf1f6d9dddd62a Mon Sep 17 00:00:00 2001
From: Vincent Bernat <[email protected]>
Date: Sat, 27 Aug 2011 20:06:26 +0200
Subject: [PATCH] Fix gtk_tray_icon_get_visual_property() when visual not
 available.

This fixes a regression introduced in commit
3518bbe28ff76a0d484df0093f6b5289edd2bebb. gdk_visual_get_*_pixel_details()
should not be called with a NULL visual.
---
 gtk/gtktrayicon-x11.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index 9c35daf..f31b58e 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -505,9 +505,12 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
       visual = gdk_x11_screen_lookup_visual (screen, visual_id);
     }
 
-  gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
-  gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
-  gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+  if (visual != NULL)
+    {
+      gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
+      gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
+      gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+    }
 
   icon->priv->manager_visual = visual;
   icon->priv->manager_visual_rgba = visual != NULL &&
-- 
1.7.5.4

-- 
Vincent Bernat ☯ http://vincent.bernat.im

Don't diddle code to make it faster - find a better algorithm.
            - The Elements of Programming Style (Kernighan & Plauger)

Reply via email to