|
|
af63927 |
From b02aef4483e615353ed11e0d3cc29621828ae502 Mon Sep 17 00:00:00 2001
|
|
|
af63927 |
From: Evangelos Foutras <evangelos@foutrelis.com>
|
|
|
af63927 |
Date: Wed, 6 Mar 2013 05:58:54 +0200
|
|
|
af63927 |
Subject: [PATCH] Fix hang when no backdrop image is selected (Bug #9892)
|
|
|
af63927 |
|
|
|
af63927 |
Checking whether backdrop->priv->image_path exists isn't enough; we'd
|
|
|
af63927 |
also have to check whether backdrop->priv->show_image is TRUE before
|
|
|
af63927 |
proceeding to apply a backdrop image.
|
|
|
af63927 |
|
|
|
af63927 |
When backdrop->priv->show_image is FALSE, iw and ih (image width/height)
|
|
|
af63927 |
will be zero, but can later be used to compute the upper limit of a for
|
|
|
af63927 |
loop as well as other computations.
|
|
|
af63927 |
|
|
|
af63927 |
To solve this, a new boolean variable (apply_backdrop_image) is added
|
|
|
af63927 |
and set to TRUE only if the return value of gdk_pixbuf_get_file_info()
|
|
|
af63927 |
is not NULL (meaning that the image format is recognized).
|
|
|
af63927 |
|
|
|
af63927 |
The above logic error was introduced in commit
|
|
|
af63927 |
ebad377e5cd067cec9f2b402dff4991ddc4cc3b5.
|
|
|
af63927 |
---
|
|
|
af63927 |
src/xfce-backdrop.c | 14 +++++++++-----
|
|
|
af63927 |
1 file changed, 9 insertions(+), 5 deletions(-)
|
|
|
af63927 |
|
|
|
af63927 |
diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
|
|
|
af63927 |
index 9a4d7db..f4c2221 100644
|
|
|
af63927 |
--- a/src/xfce-backdrop.c
|
|
|
af63927 |
+++ b/src/xfce-backdrop.c
|
|
|
af63927 |
@@ -924,6 +924,8 @@ GdkPixbuf *
|
|
|
af63927 |
xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
|
|
|
af63927 |
{
|
|
|
af63927 |
GdkPixbuf *final_image, *image = NULL, *tmp;
|
|
|
af63927 |
+ GdkPixbufFormat *format = NULL;
|
|
|
af63927 |
+ gboolean apply_backdrop_image = FALSE;
|
|
|
af63927 |
gint i, j;
|
|
|
af63927 |
gint w, h, iw = 0, ih = 0;
|
|
|
af63927 |
XfceBackdropImageStyle istyle;
|
|
|
af63927 |
@@ -933,8 +935,12 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
|
|
|
af63927 |
|
|
|
af63927 |
g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), NULL);
|
|
|
af63927 |
|
|
|
af63927 |
- if(backdrop->priv->show_image && backdrop->priv->image_path)
|
|
|
af63927 |
- gdk_pixbuf_get_file_info(backdrop->priv->image_path, &iw, &ih;;
|
|
|
af63927 |
+ if(backdrop->priv->show_image && backdrop->priv->image_path) {
|
|
|
af63927 |
+ format = gdk_pixbuf_get_file_info(backdrop->priv->image_path, &iw, &ih;;
|
|
|
af63927 |
+ /* make sure we have a usable backdrop image */
|
|
|
af63927 |
+ if(format != NULL)
|
|
|
af63927 |
+ apply_backdrop_image = TRUE;
|
|
|
af63927 |
+ }
|
|
|
af63927 |
|
|
|
af63927 |
if(backdrop->priv->width == 0 || backdrop->priv->height == 0) {
|
|
|
af63927 |
w = iw;
|
|
|
af63927 |
@@ -956,9 +962,7 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
|
|
|
af63927 |
final_image = create_solid(&backdrop->priv->color1, w, h, FALSE, 0xff);
|
|
|
af63927 |
}
|
|
|
af63927 |
|
|
|
af63927 |
- /*check if the file exists,
|
|
|
af63927 |
- *and if it doesn't then make the background the single colour*/
|
|
|
af63927 |
- if(!g_file_test(backdrop->priv->image_path, G_FILE_TEST_EXISTS)) {
|
|
|
af63927 |
+ if(!apply_backdrop_image) {
|
|
|
af63927 |
if(backdrop->priv->brightness != 0)
|
|
|
af63927 |
final_image = adjust_brightness(final_image, backdrop->priv->brightness);
|
|
|
af63927 |
|
|
|
af63927 |
--
|
|
|
af63927 |
1.8.1.5
|
|
|
af63927 |
|