From 6754614ac1ce8f72c0d0ec2369408ac61e080dab Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 27 Aug 2011 20:06:26 +0200 Subject: [PATCH] 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 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c index 9c35dafd70..f31b58e2db 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 &&