From af7151a5549d64e9a3d381f12e0d98ce9e11fa79 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Mon, 1 Nov 2010 11:53:59 -0400 Subject: [PATCH] Lock when changing album art If we lock, then we prevent the possibility that multiple threads will attempt to change the art at the same time. We hold the lock until after the resize for the same reason. --- ocarina/image.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ocarina/image.py b/ocarina/image.py index 73d24846..ccab7142 100644 --- a/ocarina/image.py +++ b/ocarina/image.py @@ -2,6 +2,10 @@ import libsaria import gtk +from libsaria import threads + +lock = threads.get_mutex("album_art") + class Image(gtk.Image): def __init__(self): gtk.Image.__init__(self) @@ -34,11 +38,13 @@ class AlbumArt(Image): self.file = "images/ocarina.png" def set(self, file=None): + lock.acquire() if file != None: self.file = file self.set_from_file(self.file) self.set_height(64) self.show() + lock.release() def set_height(self, new_h): size = self.size_request()