summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-05-26 18:58:12 +0200
committerThomas Haller <thaller@redhat.com>2019-06-13 16:10:53 +0200
commit25de86abb62488b1a88b7d34f05676a2a901515f (patch)
tree8332c8ea006ccf678cd923959049720254793fd3
parent142c1215ee1b8423e7739175a0382a91924629c6 (diff)
downloadNetworkManager-25de86abb62488b1a88b7d34f05676a2a901515f.tar.gz
manager: cleanup freeing CList in NMManager's dispose()
To unlink all elements, I find a while() loop easier to read than c_list_for_each_*safe().
-rw-r--r--src/nm-manager.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 949361f427..8960079b11 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -7605,19 +7605,18 @@ dispose (GObject *object)
{
NMManager *self = NM_MANAGER (object);
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
- CList *iter, *iter_safe;
- NMActiveConnection *ac, *ac_safe;
+ CList *iter;
nm_assert (c_list_is_empty (&priv->async_op_lst_head));
g_signal_handlers_disconnect_by_func (priv->platform,
G_CALLBACK (platform_link_cb),
self);
- c_list_for_each_safe (iter, iter_safe, &priv->link_cb_lst) {
+ while ((iter = c_list_first (&priv->link_cb_lst))) {
PlatformLinkCbData *data = c_list_entry (iter, PlatformLinkCbData, lst);
g_source_remove (data->idle_id);
- c_list_unlink_stale (iter);
+ c_list_unlink_stale (&data->lst);
g_slice_free (PlatformLinkCbData, data);
}
@@ -7646,8 +7645,9 @@ dispose (GObject *object)
nm_clear_g_source (&priv->ac_cleanup_id);
- c_list_for_each_entry_safe (ac, ac_safe, &priv->active_connections_lst_head, active_connections_lst)
- active_connection_remove (self, ac);
+ while ((iter = c_list_first (&priv->active_connections_lst_head)))
+ active_connection_remove (self, c_list_entry (iter, NMActiveConnection, active_connections_lst));
+
nm_assert (c_list_is_empty (&priv->active_connections_lst_head));
g_clear_object (&priv->primary_connection);
g_clear_object (&priv->activating_connection);