From 657983cfda4c84b3c9b8490e748b08ccbd47a81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 9 Oct 2017 17:38:54 +0200 Subject: [PATCH] Don't try to snapshot invisible icons These spew criticals when width == 0 || height == 0. --- gtk/gtkicon.c | 9 +++++---- gtk/gtkpaned.c | 9 +++++---- gtk/gtkrendericon.c | 3 +++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c index aefd1c7f8a..5424e15ee2 100644 --- a/gtk/gtkicon.c +++ b/gtk/gtkicon.c @@ -43,10 +43,11 @@ gtk_icon_snapshot (GtkWidget *widget, gtk_widget_get_content_size (widget, &width, &height); - gtk_css_style_snapshot_icon (style, - snapshot, - width, height, - self->image); + if (width > 0 && height > 0) + gtk_css_style_snapshot_icon (style, + snapshot, + width, height, + self->image); } static void diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index a759190c01..7af1076745 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -1476,10 +1476,11 @@ gtk_paned_render_handle (GtkGizmo *gizmo, gtk_widget_get_content_size (widget, &width, &height); - gtk_css_style_snapshot_icon (style, - snapshot, - width, height, - GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR); + if (width > 0 && height > 0) + gtk_css_style_snapshot_icon (style, + snapshot, + width, height, + GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR); return FALSE; } diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index 3cecd35c00..caa700568f 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -105,6 +105,9 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, g_return_if_fail (GTK_IS_CSS_STYLE (style)); g_return_if_fail (snapshot != NULL); + if (width == 0.0 || height == 0.0) + return; + image = _gtk_css_image_value_get_image (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SOURCE)); if (image == NULL) return;