diff options
author | Evangelos Foutras <evangelos@foutrelis.com> | 2013-03-06 05:58:54 +0200 |
---|---|---|
committer | Eric Koegel <eric.koegel@gmail.com> | 2013-03-09 09:08:20 +0300 |
commit | e85e3412a65d710d41c25e3af734d68826edac34 (patch) | |
tree | f4ab6c4f7acbf21ff3c41c9e6b102d28fa09a169 | |
parent | 9a9c809063fb9e0cc0778cf5efdd6c2057d7aefe (diff) | |
download | xfdesktop-e85e3412a65d710d41c25e3af734d68826edac34.tar.gz |
Port fix for bug #9892 from the xfce-4.10 branch
With the recent addition of per-workspace wallpapers (commit
88a920697b22b0653f244ede15f8e645ae013139) this bug is much harder to
trigger but can still manifest when an invalid image is selected and
style is set to Tiled. (xfce_backdrop_get_pixbuf() will hang in a for
loop.)
This commit ports the original fix for consistency and correctness
reasons. In addition, it also addresses the following warning which
appears when style is set to None:
** (xfdesktop:3236): CRITICAL **: Invalid image style: 0
-rw-r--r-- | src/xfce-backdrop.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c index 4b3a9097..a2bd53b5 100644 --- a/src/xfce-backdrop.c +++ b/src/xfce-backdrop.c @@ -845,6 +845,8 @@ GdkPixbuf * xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) { GdkPixbuf *final_image, *image = NULL, *tmp; + GdkPixbufFormat *format = NULL; + gboolean apply_backdrop_image = FALSE; gint i, j; gint w, h, iw = 0, ih = 0; XfceBackdropImageStyle istyle; @@ -856,7 +858,10 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) if(backdrop->priv->image_style != XFCE_BACKDROP_IMAGE_NONE && backdrop->priv->image_path) { - gdk_pixbuf_get_file_info(backdrop->priv->image_path, &iw, &ih); + format = gdk_pixbuf_get_file_info(backdrop->priv->image_path, &iw, &ih); + /* make sure we have a usable backdrop image */ + if(format != NULL) + apply_backdrop_image = TRUE; } if(backdrop->priv->width == 0 || backdrop->priv->height == 0) { @@ -879,9 +884,7 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop) final_image = create_solid(&backdrop->priv->color1, w, h, FALSE, 0xff); } - /*check if the file exists, - *and if it doesn't then make the background the single colour*/ - if(!g_file_test(backdrop->priv->image_path, G_FILE_TEST_EXISTS)) { + if(!apply_backdrop_image) { if(backdrop->priv->brightness != 0) final_image = adjust_brightness(final_image, backdrop->priv->brightness); |