[glib] Use G_SIGNAL_MUST_COLLECT for VARIANT signals



commit 71c7e49058c226cd3b34e85c1b25428c1eb80b84
Author: Christian Persch <chpe gnome org>
Date:   Fri Mar 4 18:21:51 2011 +0100

    Use G_SIGNAL_MUST_COLLECT for VARIANT signals
    
    Bug #643624.

 gio/gactiongroup.c  |    4 +++-
 gio/gdbusproxy.c    |   10 ++++------
 gio/gsimpleaction.c |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gio/gactiongroup.c b/gio/gactiongroup.c
index 735f016..00e1484 100644
--- a/gio/gactiongroup.c
+++ b/gio/gactiongroup.c
@@ -141,7 +141,9 @@ g_action_group_default_init (GActionGroupInterface *class)
   g_action_group_signals[SIGNAL_ACTION_STATE_CHANGED] =
     g_signal_new (I_("action-state-changed"),
                   G_TYPE_ACTION_GROUP,
-                  G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+                  G_SIGNAL_RUN_LAST |
+                  G_SIGNAL_DETAILED |
+                  G_SIGNAL_MUST_COLLECT,
                   G_STRUCT_OFFSET (GActionGroupInterface,
                                    action_state_changed),
                   NULL, NULL,
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index e9e7ecf..2159928 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -497,7 +497,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
    */
   signals[PROPERTIES_CHANGED_SIGNAL] = g_signal_new ("g-properties-changed",
                                                      G_TYPE_DBUS_PROXY,
-                                                     G_SIGNAL_RUN_LAST,
+                                                     G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
                                                      G_STRUCT_OFFSET (GDBusProxyClass, g_properties_changed),
                                                      NULL,
                                                      NULL,
@@ -520,7 +520,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
    */
   signals[SIGNAL_SIGNAL] = g_signal_new ("g-signal",
                                          G_TYPE_DBUS_PROXY,
-                                         G_SIGNAL_RUN_LAST,
+                                         G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
                                          G_STRUCT_OFFSET (GDBusProxyClass, g_signal),
                                          NULL,
                                          NULL,
@@ -1029,14 +1029,13 @@ on_name_owner_changed (GDBusConnection *connection,
           g_hash_table_size (proxy->priv->properties) > 0)
         {
           GVariantBuilder builder;
-          GVariant *changed_properties;
           GPtrArray *invalidated_properties;
           GHashTableIter iter;
           const gchar *key;
 
           /* Build changed_properties (always empty) and invalidated_properties ... */
           g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
-          changed_properties = g_variant_builder_end (&builder);
+
           invalidated_properties = g_ptr_array_new_with_free_func (g_free);
           g_hash_table_iter_init (&iter, proxy->priv->properties);
           while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL))
@@ -1049,9 +1048,8 @@ on_name_owner_changed (GDBusConnection *connection,
           /* ... and finally emit the ::g-properties-changed signal */
           g_signal_emit (proxy, signals[PROPERTIES_CHANGED_SIGNAL],
                          0,
-                         changed_properties,
+                         g_variant_builder_end (&builder) /* consumed */,
                          (const gchar* const *) invalidated_properties->pdata);
-          g_variant_unref (changed_properties);
           g_ptr_array_unref (invalidated_properties);
         }
       g_object_notify (G_OBJECT (proxy), "g-name-owner");
diff --git a/gio/gsimpleaction.c b/gio/gsimpleaction.c
index 388ead3..2b06f2d 100644
--- a/gio/gsimpleaction.c
+++ b/gio/gsimpleaction.c
@@ -323,7 +323,7 @@ g_simple_action_class_init (GSimpleActionClass *class)
   g_simple_action_signals[SIGNAL_ACTIVATE] =
     g_signal_new (I_("activate"),
                   G_TYPE_SIMPLE_ACTION,
-                  G_SIGNAL_RUN_LAST,
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
                   G_STRUCT_OFFSET (GSimpleActionClass, activate),
                   NULL, NULL,
                   g_cclosure_marshal_VOID__VARIANT,



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