[gnome-music/wip/mschraal/mrqmcq2u-debug-spew: 3/4] albumwidget: Bind ListModel early



commit c19f31641af0d9a4c8d5ff04938377108e561549
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Feb 16 21:01:45 2020 +0100

    albumwidget: Bind ListModel early
    
    If we start listening to ListModel items-changed signals before binding
    the model to the ListBox, it might not yet be synced and crash in the
    signal callback. The callback assumes the ListBox widgets are already
    created and this might result in a crash.
    
    Bind the ListBox widget before connecting the signal handler.
    
    Closes: #367

 gnomemusic/widgets/artistalbumwidget.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index 9320abfa..f2c0feaa 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -85,10 +85,10 @@ class ArtistAlbumWidget(Gtk.Box):
         if self._cover_size_group:
             self._cover_size_group.add_widget(self._cover_stack)
 
-        corealbum.props.model.connect_after(
-            "items-changed", self._on_model_items_changed)
         self._disc_list_box.bind_model(
             corealbum.props.model, self._create_widget)
+        corealbum.props.model.connect_after(
+            "items-changed", self._on_model_items_changed)
 
         corealbum.props.model.items_changed(0, 0, 0)
 


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