[gtk+] trayicon-x11: Fix warnings when visual is not available.



commit 6754614ac1ce8f72c0d0ec2369408ac61e080dab
Author: Vincent Bernat <bernat luffy cx>
Date:   Sat Aug 27 20:06:26 2011 +0200

    trayicon-x11: Fix warnings when visual is not available.
    
    This fixes a regression introduced in commit
    b1a1685a33eca16979e63d79915395af0b36. gdk_visual_get_*_pixel_details()
    should not be called with a NULL visual.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=649588

 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 &&



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]