evince/evince-3.28.2-media-player-keys.patch
2018-05-10 16:34:19 +02:00

44 lines
1.3 KiB
Diff

diff --git a/shell/ev-media-player-keys.c b/shell/ev-media-player-keys.c
index a0075edc..63a1344c 100644
--- a/shell/ev-media-player-keys.c
+++ b/shell/ev-media-player-keys.c
@@ -41,8 +41,9 @@ struct _EvMediaPlayerKeys
{
GObject parent;
- GDBusProxy *proxy;
- gboolean has_name_owner;
+ GDBusProxy *proxy;
+ gboolean has_name_owner;
+ GCancellable *service_appearance_cancellable;
};
struct _EvMediaPlayerKeysClass
@@ -187,13 +188,15 @@ mediakeys_service_appeared_cb (GObject *source_object,
static void
ev_media_player_keys_init (EvMediaPlayerKeys *keys)
{
+ keys->service_appearance_cancellable = g_cancellable_new ();
+
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
NULL,
SD_NAME,
SD_OBJECT_PATH,
SD_INTERFACE,
- NULL,
+ keys->service_appearance_cancellable,
mediakeys_service_appeared_cb,
keys);
}
@@ -212,6 +215,9 @@ ev_media_player_keys_finalize (GObject *object)
{
EvMediaPlayerKeys *keys = EV_MEDIA_PLAYER_KEYS (object);
+ g_cancellable_cancel (keys->service_appearance_cancellable);
+ g_object_unref (keys->service_appearance_cancellable);
+
if (keys->proxy != NULL) {
ev_media_player_keys_release_keys (keys);
g_object_unref (keys->proxy);