Ticket #748 (closed bug: fixed)

Opened 9 months ago

Last modified 9 months ago

hang in 0.6 on loading an invalid cover in the notification on track change

Reported by: gwicke Owned by:
Priority: major Milestone:
Component: Core Version: trunk
Keywords: Cc:

Description

Wrapping the pixbuf loading in a try/except fixes this. Revision: 851, trunk-0.6.

Index: src/widget/notify.py =================================================================== --- src/widget/notify.py (revision 851) +++ src/widget/notify.py (working copy) @@ -151,13 +151,16 @@

if song:

cover = song.get_cover_path() if os.path.exists(cover):

- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(cover,40,40) - w, h = pixbuf.get_width(), pixbuf.get_height() - line = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w + 2, h + 2) - line.fill(0x000000ff) - pixbuf.copy_area(0, 0, w, h, line, 1, 1) - icon = os.path.join(const.TMP_PATH+"/cover.png") - line.save(icon, "png", {}) + try: + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(cover,40,40) + w, h = pixbuf.get_width(), pixbuf.get_height() + line = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w + 2, h + 2) + line.fill(0x000000ff) + pixbuf.copy_area(0, 0, w, h, line, 1, 1) + icon = os.path.join(const.TMP_PATH+"/cover.png") + line.save(icon, "png", {}) + except: + icon = ""

self.hints = self.get_hints() self.last_id = self.dbus_notify.Notify("Listen", id, icon,self.title, text,actions, self.hints, timeout)

Change History

Changed 9 months ago by gwicke

Better wrap this in a wiki pre..

Index: src/widget/notify.py
===================================================================
--- src/widget/notify.py	(revision 851)
+++ src/widget/notify.py	(working copy)
@@ -151,13 +151,16 @@
             if song:
                 cover = song.get_cover_path()
                 if os.path.exists(cover):
-                    pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(cover,40,40)
-                    w, h = pixbuf.get_width(), pixbuf.get_height()
-                    line = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w + 2, h + 2)
-                    line.fill(0x000000ff)
-                    pixbuf.copy_area(0, 0, w, h, line, 1, 1)
-                    icon = os.path.join(const.TMP_PATH+"/cover.png")
-                    line.save(icon, "png", {})
+                    try:
+                        pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(cover,40,40)
+                        w, h = pixbuf.get_width(), pixbuf.get_height()
+                        line = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w + 2, h + 2)
+                        line.fill(0x000000ff)
+                        pixbuf.copy_area(0, 0, w, h, line, 1, 1)
+                        icon = os.path.join(const.TMP_PATH+"/cover.png")
+                        line.save(icon, "png", {})
+                    except:
+                        icon = ""
                 
             self.hints = self.get_hints()
             self.last_id = self.dbus_notify.Notify("Listen", id, icon,self.title, text,actions, self.hints, timeout)

Changed 9 months ago by theli

  • status changed from new to closed
  • resolution set to fixed

(In [852]) Capture pixbuf loaded exception, fixes #748

Note: See TracTickets for help on using tickets.