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:
parent
5a6b321ffe
commit
af7151a554
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue