[glib: 2/3] gdbusproxy: only connect to NameOwnerChanged for message buses



commit dec0a6874e99c70092ce3d54184782b17bc129f2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 20 00:37:11 2018 +0000

    gdbusproxy: only connect to NameOwnerChanged for message buses
    
    Names are a message bus feature, so it does not make sense to connect
    to NameOwnerChanged when the underlying connection is not a message
    bus.
    
    Moreover, g_dbus_connection_signal_subscribe() will also enforce that
    condition. Adding this extra check here is helpful to avoid a critical
    warning when using GDBusProxy with peer-to-peer connections.
    
    https://gitlab.gnome.org/GNOME/glib/issues/1620

 gio/gdbusproxy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index 9cfb82d70..6a1be4220 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -1768,7 +1768,8 @@ async_initable_init_first (GAsyncInitable *initable)
                                             (GDestroyNotify) signal_subscription_unref);
     }
 
-  if (proxy->priv->name != NULL)
+  if (proxy->priv->name != NULL &&
+      (g_dbus_connection_get_flags (proxy->priv->connection) & 
G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION))
     {
       proxy->priv->name_owner_changed_subscription_id =
         g_dbus_connection_signal_subscribe (proxy->priv->connection,


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