ocarina: Gtk locking around album art resize
I only want one thread modifying album art at a time, so I need to use threads_enter() and threads_leave() here.
This commit is contained in:
parent
0862c57b6a
commit
217156d322
|
@ -9,8 +9,7 @@ def find_new_width(buf, new_h):
|
|||
h = buf.get_height()
|
||||
if h == 0:
|
||||
h = 1
|
||||
new_w = (float(w) / float(h)) * new_h
|
||||
return int(new_w)
|
||||
return int( (float(w) / float(h)) * new_h )
|
||||
|
||||
def _resize(img, new_h):
|
||||
buf = img.get_pixbuf()
|
||||
|
@ -26,10 +25,12 @@ def resize(img, new_h):
|
|||
if new_h == 0:
|
||||
return
|
||||
new_h = int(new_h)
|
||||
gtk.threads_enter()
|
||||
try:
|
||||
_resize(img, new_h)
|
||||
except Exception, e:
|
||||
print e
|
||||
gtk.threads_leave()
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user