[gnome-music: 4/6] Lock the dict while searching in frame_cache
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-music: 4/6] Lock the dict while searching in frame_cache
 
- Date: Mon,  5 Aug 2013 20:41:10 +0000 (UTC)
 
commit 6f1671be05bb8e45d71e69bef5a573408c8deb10
Author: Guillaume Quintard <guillaume quintard gmail com>
Date:   Mon Aug 5 20:39:53 2013 +0200
    Lock the dict while searching in frame_cache
 gnomemusic/albumArtCache.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/albumArtCache.py b/gnomemusic/albumArtCache.py
index 97e3522..ebbfb40 100644
--- a/gnomemusic/albumArtCache.py
+++ b/gnomemusic/albumArtCache.py
@@ -278,6 +278,7 @@ class AlbumArtCache:
 
     def _draw_rounded_path(self, x, y, width, height, radius):
         key = "%dx%d %dx%d:%d" % (width, height, x, y, radius)
+        self.frame_lock.acquire()
         if not key in self.frame_cache:
             surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
                     width, height)
@@ -297,10 +298,10 @@ class AlbumArtCache:
             ctx.stroke_preserve()
             ctx.set_source_rgb(1, 1, 1)
             ctx.fill()
-            self.frame_lock.acquire()
             self.frame_cache[key] = Gdk.pixbuf_get_from_surface(surface, 0, 0, width, height)
-            self.frame_lock.release()
-        return self.frame_cache[key].copy()
+        res = self.frame_cache[key].copy()
+        self.frame_lock.release()
+        return res
 
     def lookup(self, item, width, height, callback, data=None):
         request = LookupRequest(item, width, height, callback, data)
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]