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.
This commit is contained in:
Bryan Schumaker 2010-11-01 11:53:59 -04:00
parent 5a6b321ffe
commit af7151a554
1 changed files with 6 additions and 0 deletions

View File

@ -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()