device: remove the unreferenced unreal devices

When there's no connection that would use an unrealized device there's no more
reason to keep the device in memory. It's in fact a resource leak.
This commit is contained in:
Lubomir Rintel 2015-12-14 12:51:49 +01:00
parent a22a109ad6
commit 436ec5b8e3

View file

@ -2068,6 +2068,11 @@ nm_device_unrealize (NMDevice *self, gboolean remove_resources, GError **error)
remove_resources ?
NM_DEVICE_STATE_REASON_USER_REQUESTED : NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
/* Garbage-collect unneeded unrealized devices. */
nm_device_recheck_available_connections (self);
if (g_hash_table_size (priv->available_connections) == 0)
g_signal_emit_by_name (self, NM_DEVICE_REMOVED);
return TRUE;
}