diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-12-14 12:51:49 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-12-14 12:51:49 +0100 |
commit | 436ec5b8e37ca2e5fc0f8d09a4c5f09cf406b4a5 (patch) | |
tree | a140614edd450beda294e08217a4f0304ab0500a /src/devices | |
parent | a22a109ad6a56b439f3f19c289b0c45dcd4fdf6d (diff) | |
download | NetworkManager-436ec5b8e37ca2e5fc0f8d09a4c5f09cf406b4a5.tar.gz |
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.
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/nm-device.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 402b977ff7..9fb944c25d 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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; } |