Instead load a fallback icon and proceed as normal.

https://bugs.freedesktop.org/show_bug.cgi?id=53860
---
 clients/desktop-shell.c | 19 ++++++++++++++++++-
 1 Datei geändert, 18 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index dc87e75..fe8fe02 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -472,6 +472,23 @@ panel_create(struct display *display)
        return panel;
 }
 
+static cairo_surface_t *
+load_icon_or_fallback(const char *icon)
+{
+       cairo_surface_t *surface = cairo_image_surface_create_from_png(icon);
+
+       if (cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS)
+               return surface;
+
+       fprintf(stderr, "ERROR loading icon from file '%s'\n", icon);
+
+       // loading fallback
+       surface = cairo_image_surface_create_from_png(
+           DATADIR "/weston/icon_window.png");
+
+       return surface;
+}
+
 static void
 panel_add_launcher(struct panel *panel, const char *icon, const char *path)
 {
@@ -481,7 +498,7 @@ panel_add_launcher(struct panel *panel, const char *icon, 
const char *path)
 
        launcher = malloc(sizeof *launcher);
        memset(launcher, 0, sizeof *launcher);
-       launcher->icon = cairo_image_surface_create_from_png(icon);
+       launcher->icon = load_icon_or_fallback(icon);
        launcher->path = strdup(path);
 
        wl_array_init(&launcher->envp);
-- 
1.7.12

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to