From 9622733140c90a472f06362fbbc970513c508735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 27 Feb 2019 22:11:46 +0100 Subject: [PATCH] window: Handle broken icon themes more gracefully MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We assert that the icons used as default window icons are loaded correctly, but currently this can fail simply because of an incomplete icon theme. After all, "image-missing" was only added to the icon-naming spec in 2005 🙄 Handle this case more gracefully by falling back to a completely transparent "icon". https://bugzilla.gnome.org/show_bug.cgi?id=720583 https://gitlab.gnome.org/GNOME/mutter/merge_requests/462 --- src/core/window.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/window.c b/src/core/window.c index c112c7d59..9712e6d87 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -5357,7 +5357,11 @@ load_default_window_icon (int size) icon_name = "image-missing"; pixbuf = gtk_icon_theme_load_icon (theme, icon_name, size, 0, NULL); - return gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL); + + if (pixbuf != NULL) + return gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL); + + return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size); } static cairo_surface_t *