wifi/supplicant: take object reference during availability_changed()

If the list is expected to be modified, it also means that possibly
instances will be unrefed. Probably, not yet visited instances will
not be unrefed so there is no real problem.

Just be extra cautious and take a reference to all instances first.

(cherry picked from commit 004edecc81)
This commit is contained in:
Thomas Haller 2016-01-19 14:30:12 +01:00
parent 91bdabc808
commit 213c20142c

View file

@ -200,9 +200,11 @@ availability_changed (NMSupplicantManager *self, gboolean available)
/* priv->ifaces may be modified if availability changes; can't use GHashTableIter */
ifaces = g_hash_table_get_values (priv->ifaces);
for (iter = ifaces; iter; iter = iter->next)
g_object_ref (iter->data);
for (iter = ifaces; iter; iter = iter->next)
nm_supplicant_interface_set_supplicant_available (NM_SUPPLICANT_INTERFACE (iter->data), available);
g_list_free (ifaces);
g_list_free_full (ifaces, g_object_unref);
}
static gboolean