[gnome-desktop] gnome-bg: set error when parsing XML file that's not a slide show



commit 5e3ac2bc0c789f3b7c02fc98787d242c1b601fdd
Author: Ray Strode <rstrode redhat com>
Date:   Thu Sep 26 17:04:54 2013 -0400

    gnome-bg: set error when parsing XML file that's not a slide show
    
    While trying to reproduce a background handling bug in the shell I
    decided to run:
    
        while true; do
            for f in ~/Pictures/*; do
                gsettings set org.gnome.desktop.background picture-uri "file:///$f"
                sleep .4;
            done;
        done
    
    I noticed spew coming from gnome-shell:
    
        G_CRITICAL: g_task_return_error: assertion 'error != NULL' failed
    
    Turns out I had a non-slideshow XML file in there, and it was failing
    because there were 0 slides, but not setting an error.
    
    This commit fixes that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708877

 libgnome-desktop/gnome-bg-slide-show.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg-slide-show.c b/libgnome-desktop/gnome-bg-slide-show.c
index 1628b23..0d38ddf 100644
--- a/libgnome-desktop/gnome-bg-slide-show.c
+++ b/libgnome-desktop/gnome-bg-slide-show.c
@@ -682,6 +682,10 @@ parse_file_contents (GnomeBGSlideShow  *self,
 
                 /* no slides, that's not a slideshow */
                 if (len == 0) {
+                        g_set_error_literal (error,
+                                             G_MARKUP_ERROR,
+                                             G_MARKUP_ERROR_INVALID_CONTENT,
+                                             "file is not a slide show since it has no slides");
                         failed = TRUE;
                 /* one slide, there's no transition */
                 } else if (len == 1) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]