[gnome-music/wip/mschraal/core-thumb-property: 4/16] artistartstack: Disconnect cache callback



commit baf1cbb43d6cfe011290152202eecdf243e8df32
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Apr 5 21:54:42 2020 +0200

    artistartstack: Disconnect cache callback
    
    When a new ArtCache is created, the old callback can be disconnected and
    reused.

 gnomemusic/widgets/artistartstack.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gnomemusic/widgets/artistartstack.py b/gnomemusic/widgets/artistartstack.py
index b3aeec0d..2e2f0d23 100644
--- a/gnomemusic/widgets/artistartstack.py
+++ b/gnomemusic/widgets/artistartstack.py
@@ -108,6 +108,8 @@ class ArtistArtStack(Gtk.Stack):
             self._on_thumbnail_changed(self._coreartist, None)
 
     def _on_thumbnail_changed(self, coreartist, uri):
+        self._disconnect_cache()
+
         self._cache = ArtCache(self.props.size, self.props.scale_factor)
         self._handler_id = self._cache.connect("result", self._on_cache_result)
 
@@ -125,6 +127,9 @@ class ArtistArtStack(Gtk.Stack):
         # If the stacm is destroyed while the art is updated, an error
         # can occur once the art is retrieved because the CoverStack
         # does not have children anymore.
+        self._disconnect_cache()
+
+    def _disconnect_cache(self):
         if (self._cache is not None
                 and self._handler_id is not None):
             self._cache.disconnect(self._handler_id)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]