mpris: Prevent DBus race when creating media players

Sometimes an MPRIS media player will create and then destroy an object
before the signals that handle the object's destruction can be created.
This verifies that the object still exists after the necessary signals
have been created.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2776


(cherry picked from commit f526e592fe)
This commit is contained in:
Bryan Dunsmore 2020-05-13 05:38:01 +00:00 committed by Florian Müllner
parent fde8519002
commit 504d4b7ea4

View File

@ -173,6 +173,11 @@ var MprisPlayer = class MprisPlayer {
if (!this._mprisProxy.g_name_owner) if (!this._mprisProxy.g_name_owner)
this._close(); this._close();
}); });
// It is possible for the bus to disappear before the previous signal
// is connected, so we must ensure that the bus still exists at this
// point.
if (!this._mprisProxy.g_name_owner)
this._close();
} }
_onPlayerProxyReady() { _onPlayerProxyReady() {