[glib] GDBusProxy: Drop unexpected signals



commit caf993df6f9dbf2cd01ae16f5d757187c44683e3
Author: David Zeuthen <davidz redhat com>
Date:   Mon Mar 28 12:10:25 2011 -0400

    GDBusProxy: Drop unexpected signals
    
    If we have an expected interface and receive a signal not mentioned in
    the interface, simply drop it. This way, the application won't have to
    check for the signal itself.
    
    This was pointed out in
    
     https://bugzilla.gnome.org/show_bug.cgi?id=642724#c5
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gdbusproxy.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index eecbaf6..2b76090 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -755,6 +755,14 @@ on_signal_received (GDBusConnection *connection,
   if (proxy->priv->name_owner != NULL && g_strcmp0 (sender_name, proxy->priv->name_owner) != 0)
     goto out;
 
+  if (proxy->priv->expected_interface != NULL)
+    {
+      const GDBusSignalInfo *info;
+      info = g_dbus_interface_info_lookup_signal (proxy->priv->expected_interface, signal_name);
+      if (info == NULL)
+        goto out;
+    }
+
   g_signal_emit (proxy,
                  signals[SIGNAL_SIGNAL],
                  0,



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