Package: gnome-splashscreen-manager
Version: 0.2-12

When I invoke `gnome-splashscreen-manager' it fails with an error Unrecognised 
image file format (Gdk::PixbufError)

This is the complete output:
$ gnome-splashscreen-manager
/usr/lib/ruby/1.8/gnome-splashscreen-manager/splash_screens.rb:192:in 
`last_write': Unrecognised image file format (Gdk::PixbufError)
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/splash_screens.rb:192:in 
`download_pixbuf'
        from /usr/lib/ruby/1.8/open-uri.rb:32:in `open_uri_original_open'
        from /usr/lib/ruby/1.8/open-uri.rb:32:in `open'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/splash_screens.rb:191:in 
`download_pixbuf'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/splash_screens.rb:199:in 
`create_thumbnail'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/splash_screens.rb:271:in 
`get_splash_screens'
        from /usr/lib/ruby/1.8/rexml/element.rb:934:in `each'
        from /usr/lib/ruby/1.8/rexml/xpath.rb:53:in `each'
        from /usr/lib/ruby/1.8/rexml/element.rb:934:in `each'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/splash_screens.rb:221:in 
`get_splash_screens'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/ui/main_window.rb:261:in 
`reload_splash_screens'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/ui/main_window.rb:458:in 
`initialize'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/gnome_splashscreen_manager.rb:62:in
 `new'
        from 
/usr/lib/ruby/1.8/gnome-splashscreen-manager/gnome_splashscreen_manager.rb:62:in
 `main'
        from /usr/bin/gnome-splashscreen-manager:25

The image file of the downloaded splashscreen is corrupted but I think that it 
is wrong to break the whole program.
It would be right to automatically remove the corrupted entries and continues 
it's lifecycle.

The problem is on the download_pixbuf method of the splash_screen.rb script. 
The loader throws a Gdk::PixbufError if the file is not a correct image file 
(from a corrupted download maybe) and this exception is unhandled. This method 
is used by the create_thumbnail method to read the image and create the 
thumbnail for the program's main window.
So because the MainWindow.rb constructor at start reads the
#{Home_dir}/#{Gnome_dir}/splash-screens.xml and creates the thumbnails
of the image files, it goes down..

You can reproduce it very easy, just add a <splash_screen> entry at
#{Home_dir}/#{Gnome_dir}/splash-screens.xml file and touch the file you
entered for filename in the entry. The file is not a correct image file
and the whole thing will fail.

I think that the solution is pretty simple but I 'm a java developer at
most and not at all familiar with ruby (so maybe there is a more
sophisticated way to handle this situation), what I did to fix it is:

1) changed the splash_screens.rb script at line 190 to add an exception
handler and return nil on error:
old code snippet:
 loader = Gdk::PixbufLoader.new
     open(url) { |f|
 loader.last_write(f.read)
     }

new code snippet:
 begin
      loader = Gdk::PixbufLoader.new
      open(url) { |f|
        loader.last_write(f.read)
      }
 rescue
  puts "Error in image file format: "+url

  return nil
 end

2) edit the splash_screens.rb again into method create_thumbnail (line
205 with the new code snippet) and added between pixbuf =
download_pixbuf(url) and pixbuf.scale(130, 90,
Gdk::Pixbuf::INTERP_BILINEAR) this code snippet:
      if (pixbuf == nil)
            return nil
      end

That's it. Now the reload_splash_screens method that runs at start of the 
program will load the thumbnails and every nil thumbnail will be deleted from 
your #{Home_dir}/#{Gnome_dir}/splash-screens.xml file with a notification 
message at standard output to delete the image file manually from your 
filesystem.

I am using Debian GNU/Linux 5, kernel 2.6.26-1-amd64, gnome 2.22.3




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to