Mercurial > audlegacy
changeset 3603:c983b83967db
Gracefully handle the failure of loading pixmaps.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sun, 23 Sep 2007 13:47:56 -0500 |
parents | 968144b94ece |
children | 285c6afe0c41 |
files | src/audacious/skin.c |
diffstat | 1 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/skin.c Sun Sep 23 13:47:38 2007 -0500 +++ b/src/audacious/skin.c Sun Sep 23 13:47:56 2007 -0500 @@ -367,6 +367,9 @@ basenames[i] = NULL; } + if (filename == NULL) + return FALSE; + if (!(gpm = pixmap_new_from_file(filename))) { g_warning("loading of %s failed", filename); g_free(filename); @@ -1402,7 +1405,7 @@ gdk_cursor_unref(cursor_gdk); } -static void +static gboolean skin_load_pixmaps(Skin * skin, const gchar * path) { GdkPixmap *text_pm; @@ -1427,7 +1430,7 @@ inifile = open_ini_file(filename); if (!inifile) - return; + return FALSE; skin->colors[SKIN_PLEDIT_NORMAL] = skin_load_color(inifile, "Text", "Normal", "#2499ff"); @@ -1449,6 +1452,8 @@ skin_mask_create(skin, path, SKIN_MASK_EQ_SHADE, equalizerwin->window); skin_load_viscolor(skin, path, "viscolor.txt"); + + return TRUE; } static gboolean @@ -1477,7 +1482,9 @@ /* Parse the hints for this skin. */ skin_parse_hints(skin, NULL); - skin_load_pixmaps(skin, path); + if (!skin_load_pixmaps(skin, path)) + return FALSE; + skin_load_cursor(skin, path); return TRUE; @@ -1491,7 +1498,13 @@ /* Parse the hints for this skin. */ skin_parse_hints(skin, cpath); - skin_load_pixmaps(skin, cpath); + if (!skin_load_pixmaps(skin, cpath)) + { + del_directory(cpath); + g_free(cpath); + return FALSE; + } + skin_load_cursor(skin, cpath); del_directory(cpath);