[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 143/331] Check parameter signature for signals from aptd



commit d5e84db83548303389a7054654cb7e65c6adca7c
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Mar 4 15:40:54 2016 +1300

    Check parameter signature for signals from aptd

 src/plugins/gs-plugin-apt.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.c b/src/plugins/gs-plugin-apt.c
index a0d76cd..7761d5e 100644
--- a/src/plugins/gs-plugin-apt.c
+++ b/src/plugins/gs-plugin-apt.c
@@ -559,9 +559,13 @@ transaction_property_changed_cb (GDBusConnection *connection,
        const gchar *name;
        g_autoptr(GVariant) value = NULL;
 
-       g_variant_get (parameters, "(&sv)", &name, &value);
-       if (data->app && strcmp (name, "Progress") == 0)
-               gs_plugin_progress_update (data->plugin, data->app, g_variant_get_int32 (value));
+       if (g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(sv)"))) {
+               g_variant_get (parameters, "(&sv)", &name, &value);
+               if (data->app && strcmp (name, "Progress") == 0)
+                       gs_plugin_progress_update (data->plugin, data->app, g_variant_get_int32 (value));
+       } else {
+               g_warning ("Unknown parameters in %s.%s: %s", interface_name, signal_name, 
g_variant_get_type_string (parameters));
+       }
 }
 
 static void
@@ -575,7 +579,10 @@ transaction_finished_cb (GDBusConnection *connection,
 {
        TransactionData *data = user_data;
 
-       g_variant_get (parameters, "(s)", data->result);
+       if (g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(s)")))
+               g_variant_get (parameters, "(s)", data->result);
+       else
+               g_warning ("Unknown parameters in %s.%s: %s", interface_name, signal_name, 
g_variant_get_type_string (parameters));
 
        g_main_loop_quit (data->loop);
 }


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