[gnome-software/wip/rancell/apt] Check parameter signature for signals from aptd



commit 734ac41b8a3af77672bc0595dcf57ce88fe6f38e
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 fd814c0..3882329 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]