bluetooth: Fix crash when receiving a PropertyChanged with new devices
authorVinicius Costa Gomes <vinicius.gomes@intel.com>
Mon, 26 Aug 2013 17:52:36 +0000 (14:52 -0300)
committerVinicius Costa Gomes <vinicius.gomes@intel.com>
Wed, 4 Sep 2013 21:52:14 +0000 (18:52 -0300)
This signal is emitted when a previously unknown device connects to
the host, for example, when you receive a connection from a device
that is not already paired.

bluetooth/bluetooth_context_bluez4.cc

index 7f09808..bbfd9da 100644 (file)
@@ -45,11 +45,11 @@ void BluetoothContext::OnSignal(GDBusProxy* proxy, gchar* sender, gchar* signal,
 
     if (!strcmp(name, "Devices")) {
       char* path;
-      GVariantIter iter;
+      GVariantIter *iter;
 
       g_variant_get(value, "ao", &iter);
 
-      while (g_variant_iter_loop(&iter, "o", &path)) {
+      while (g_variant_iter_loop(iter, "o", &path)) {
         g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
                                  NULL,
                                  /* GDBusInterfaceInfo */
@@ -59,7 +59,7 @@ void BluetoothContext::OnSignal(GDBusProxy* proxy, gchar* sender, gchar* signal,
                                  OnDeviceProxyCreatedThunk, data);
       }
 
-      g_variant_iter_free(&iter);
+      g_variant_iter_free(iter);
     } else {
       picojson::value::object property_updated;
       property_updated["cmd"] = picojson::value("AdapterUpdated");