[gnome-music/wip/mschraal/remove-playlists-loaded-signal-3-34: 1/2] mpris: Fix early signal crash
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/remove-playlists-loaded-signal-3-34: 1/2] mpris: Fix early signal crash
- Date: Thu, 23 Jan 2020 16:41:57 +0000 (UTC)
commit dcb65859461d8a04031da4131e474d4f7e4f1bee
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Jan 9 16:03:34 2020 +0100
mpris: Fix early signal crash
During setup, when an early signal is sent, the DBusInterface might not
be ready. Resulting in a crash.
Instead, wait until the signal dict is filled before trying to send a
signal.
gnomemusic/mpris.py | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 944d0403..f3ae494e 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -46,6 +46,7 @@ class DBusInterface:
:param str path: object path
"""
self._path = path
+ self._signals = None
Gio.bus_get(Gio.BusType.SESSION, None, self._bus_get_sync, name)
def _bus_get_sync(self, source, res, name):
@@ -124,6 +125,9 @@ class DBusInterface:
invocation.return_value(None)
def _dbus_emit_signal(self, signal_name, values):
+ if self._signals is None:
+ return
+
signal = self._signals[signal_name]
parameters = []
for arg_name, arg_signature in signal['args'].items():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]