policy: fix disposal of devices list

When disposing NMPolicy all the devices in the devices hash-table should
be unregistered and removed from the hash-table.

Fixes: 7e3d090acb ('policy: refactor tracking of registered devices')
(cherry picked from commit 5a87683b14)
This commit is contained in:
Fernando Fernandez Mancera 2022-09-21 15:22:10 +02:00 committed by Thomas Haller
parent c456bfa7c4
commit d23c6040f8
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2893,7 +2893,7 @@ dispose(GObject *object)
}
g_hash_table_iter_init(&h_iter, priv->devices);
if (g_hash_table_iter_next(&h_iter, (gpointer *) &device, NULL)) {
while (g_hash_table_iter_next(&h_iter, (gpointer *) &device, NULL)) {
g_hash_table_iter_remove(&h_iter);
devices_list_unregister(self, device);
}