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



commit de9aefb299df5f1e2e54691b92abedf08fb10979
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 5d18d086..163d75e2 100644
--- a/gnomemusic/widgets/artistartstack.py
+++ b/gnomemusic/widgets/artistartstack.py
@@ -106,6 +106,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)
 
@@ -123,6 +125,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]