[xfdesktop] Fix background bug. Fixes bug #918646 (Xfce bug #9892)

Kevin Fenzi kevin at fedoraproject.org
Wed Mar 6 20:49:51 UTC 2013


commit af639276f4e0bc2413bfb2c50d6fe7cf11f3cd44
Author: Kevin Fenzi <kevin at scrye.com>
Date:   Wed Mar 6 13:49:49 2013 -0700

    Fix background bug. Fixes bug #918646 (Xfce bug #9892)

 xfdesktop-4.10.1-background-bug.patch |   65 +++++++++++++++++++++++++++++++++
 xfdesktop.spec                        |    9 ++++-
 2 files changed, 73 insertions(+), 1 deletions(-)
---
diff --git a/xfdesktop-4.10.1-background-bug.patch b/xfdesktop-4.10.1-background-bug.patch
new file mode 100644
index 0000000..cd8bee9
--- /dev/null
+++ b/xfdesktop-4.10.1-background-bug.patch
@@ -0,0 +1,65 @@
+From b02aef4483e615353ed11e0d3cc29621828ae502 Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos at foutrelis.com>
+Date: Wed, 6 Mar 2013 05:58:54 +0200
+Subject: [PATCH] Fix hang when no backdrop image is selected (Bug #9892)
+
+Checking whether backdrop->priv->image_path exists isn't enough; we'd
+also have to check whether backdrop->priv->show_image is TRUE before
+proceeding to apply a backdrop image.
+
+When backdrop->priv->show_image is FALSE, iw and ih (image width/height)
+will be zero, but can later be used to compute the upper limit of a for
+loop as well as other computations.
+
+To solve this, a new boolean variable (apply_backdrop_image) is added
+and set to TRUE only if the return value of gdk_pixbuf_get_file_info()
+is not NULL (meaning that the image format is recognized).
+
+The above logic error was introduced in commit
+ebad377e5cd067cec9f2b402dff4991ddc4cc3b5.
+---
+ src/xfce-backdrop.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
+index 9a4d7db..f4c2221 100644
+--- a/src/xfce-backdrop.c
++++ b/src/xfce-backdrop.c
+@@ -924,6 +924,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;
+@@ -933,8 +935,12 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
+     
+     g_return_val_if_fail(XFCE_IS_BACKDROP(backdrop), NULL);
+     
+-    if(backdrop->priv->show_image && backdrop->priv->image_path)
+-        gdk_pixbuf_get_file_info(backdrop->priv->image_path, &iw, &ih);
++    if(backdrop->priv->show_image && backdrop->priv->image_path) {
++        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) {
+         w = iw;
+@@ -956,9 +962,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);
+         
+-- 
+1.8.1.5
+
diff --git a/xfdesktop.spec b/xfdesktop.spec
index b19d492..b8c459f 100644
--- a/xfdesktop.spec
+++ b/xfdesktop.spec
@@ -2,7 +2,7 @@
 
 Name:           xfdesktop
 Version:        4.10.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Desktop manager for the Xfce Desktop Environment
 
 Group:          User Interface/Desktops
@@ -12,6 +12,9 @@ URL:            http://www.xfce.org/
 Source0:        http://archive.xfce.org/src/xfce/%{name}/%{xfceversion}/%{name}-%{version}.tar.bz2
 # Fix desktop file
 Patch1:         xfdesktop-4.9.2-fix-desktop.patch
+# Fix for bug https://bugzilla.xfce.org/show_bug.cgi?id=9892
+# https://bugzilla.xfce.org/attachment.cgi?id=4948
+Patch2:         xfdesktop-4.10.1-background-bug.patch
 ## Downstream patches
 # Change default background for Fedora
 Patch10:        xfdesktop-4.9.3-backdrop-image.patch
@@ -49,6 +52,7 @@ This package includes a desktop manager for the Xfce Desktop Environment.
 %setup -q
 
 %patch1 -p1 -b .fix
+%patch2 -p1 -b .background-bug
 %patch10 -p1 -b .backdrop
 
 
@@ -100,6 +104,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 
 
 %changelog
+* Wed Mar 06 2013 Kevin Fenzi <kevin at scrye.com> 4.10.1-2
+- Fix background bug. Fixes bug #918646 (Xfce bug #9892)
+
 * Sat Mar 02 2013 Kevin Fenzi <kevin at scrye.com> 4.10.1-1
 - Update to 4.10.1
 


More information about the scm-commits mailing list