[gnome-music/wip/jfelder/3-34-mpris-tracklist-crash] mpris: Update the tracklist once the song has changed



commit 03fc0ac9cab916958d14eb9894f2fcd7d83cc9fc
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Oct 11 21:42:08 2019 +0200

    mpris: Update the tracklist once the song has changed
    
    When a tracklist changes (a new playlist has been loaded in the
    CoreModel), the MPRIS tracklist needs to be updated by calling
    _update_songs_list method. It relies on the current_position property
    from the Player to update this list. However, this property has not
    been updated yet. Indeed, It will be updated by the play method of the
    Player. This incorrect call can result in a crash if the new playlist
    has less elements than the previous one.
    
    It turns out that the update_songs_list method is called two times
    every time a new playlist is loaded. The first time once the new
    playlist is loaded, and the other time once the new song starts
    playing.
    
    Fix the issue by removing the first _update_songs_list call. The MPRIS
    tracklist is already correctly updated once the new song starts
    playing.
    
    Closes: #322
    (cherry picked from commit 620c0eb5e1847ed89d3ef2ec6b2e2da44fa4fadb)

 gnomemusic/mpris.py | 1 -
 1 file changed, 1 deletion(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index ff8f2e07..f8d91538 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -578,7 +578,6 @@ class MPRIS(DBusInterface):
     @log
     def _on_player_playlist_changed(self, coremodel, playlist_type):
         self._player_playlist_type = playlist_type
-        self._update_songs_list()
 
         mpris_playlist = self._get_active_playlist()
         if mpris_playlist == self._previous_mpris_playlist:


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