Skip to content
  • Friedrich W. H. Kossebau's avatar
    MPRIS control: do not accumulate interface objects · 72fc67ee
    Friedrich W. H. Kossebau authored
    Summary:
    If MPRIS players were appearing and disappearing multiple times, the
    OrgFreedesktopDBusPropertiesInterface & OrgMprisMediaPlayer2PlayerInterface
    instances created for listening to the signals had been accumulating and
    thus resulting in X signals per X restarted player, because the instances
    were not deleted when a player disappeared.
    Additionally were instances of them created on the fly on the stack in
    some of the methods, instead of reusing the existing ones.
    
    This patch changes that by introducing a class MprisPlayer which holds all
    data & instances per player. This allows to look up the respective
    interfaces instances to reuse them as well as properly controlling their
    lifetime.
    
    Test Plan:
    Starting and restarting multiple MPRIS players (incl. multiple instances of
    the same player app) works as expected as befire. They are listed on the
    Android Media control as well as have proper states there when selected.
    Additionally no longer multiple change signals are emitted if restarting a
    player.
    
    Reviewers: #kde_connect, mtijink
    
    Reviewed By: #kde_connect, mtijink
    
    Subscribers: mtijink
    
    Differential Revision: https://phabricator.kde.org/D11389
    72fc67ee