From eea06b8a8cf144fd6436879d78d6c50e0e4b8849 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Mon, 22 Jan 2018 19:19:32 +0100 Subject: [PATCH] iwd: initialize priv->can_connect when DBus interface appears Call state_changed with the initial Device.State property value to make sure can_connect and can_scan are up to date. --- src/devices/wifi/nm-device-iwd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index 6c54120391..022c37cbb8 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -1835,7 +1835,7 @@ nm_device_iwd_set_dbus_object (NMDeviceIwd *self, GDBusObject *object) { NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self); GDBusInterface *interface; - gs_unref_variant GVariant *value = NULL; + GVariant *value; if (!nm_g_object_ref_set ((GObject **) &priv->dbus_obj, (GObject *) object)) return; @@ -1864,8 +1864,13 @@ nm_device_iwd_set_dbus_object (NMDeviceIwd *self, GDBusObject *object) value = g_dbus_proxy_get_cached_property (priv->dbus_proxy, "Scanning"); priv->scanning = g_variant_get_boolean (value); + g_variant_unref (value); priv->scan_requested = FALSE; + value = g_dbus_proxy_get_cached_property (priv->dbus_proxy, "State"); + state_changed (self, g_variant_get_string (value, NULL)); + g_variant_unref (value); + g_signal_connect (priv->dbus_proxy, "g-properties-changed", G_CALLBACK (properties_changed), self);