diff options
author | Thomas Haller <thaller@redhat.com> | 2018-03-27 16:13:17 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-04-04 14:02:13 +0200 |
commit | 45c24fb9397d49c08a6d37b8ddcc7c06a5af0b58 (patch) | |
tree | 4a92ef4707db59fce14d36a51c91a61b98ad6a65 | |
parent | ffb492678ec5c22626f334fa7b3b769d284f074c (diff) | |
download | NetworkManager-45c24fb9397d49c08a6d37b8ddcc7c06a5af0b58.tar.gz |
checkpoint/trivial: rename nm_checkpoint_manager_unref() to nm_checkpoint_manager_free()
NMCheckpointManager was added and is not ref-countable, because it
is not needed.
I still often like for such objects (that are not ref-countable),
that their destroy function is called "unref". Both for consistency,
and also if we would later add ref-counting to the object.
However, NMCheckpointManager keeps a pointer to NMManager. So, when
NMManager gets destroyed, it *MUST* destroy the NMCheckpointManager.
It cannot accept that the checkpoint manager outlives NMManager,
but the "unref" name suggests that somebody else might have still
a reference to this object keeping it alive. That is not the case.
Rename so that this is clear.
I would name it nm_checkpoint_manager_destroy(), but "destroy" already
has a meaning for NMCheckpoint instances, so use "free".
-rw-r--r-- | src/nm-checkpoint-manager.c | 2 | ||||
-rw-r--r-- | src/nm-checkpoint-manager.h | 3 | ||||
-rw-r--r-- | src/nm-manager.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/nm-checkpoint-manager.c b/src/nm-checkpoint-manager.c index 911577f46d..fa163527a2 100644 --- a/src/nm-checkpoint-manager.c +++ b/src/nm-checkpoint-manager.c @@ -346,7 +346,7 @@ nm_checkpoint_manager_new (NMManager *manager, GParamSpec *spec) } void -nm_checkpoint_manager_unref (NMCheckpointManager *self) +nm_checkpoint_manager_free (NMCheckpointManager *self) { if (!self) return; diff --git a/src/nm-checkpoint-manager.h b/src/nm-checkpoint-manager.h index 4ff75303ed..a78743ac9e 100644 --- a/src/nm-checkpoint-manager.h +++ b/src/nm-checkpoint-manager.h @@ -28,7 +28,8 @@ typedef struct _NMCheckpointManager NMCheckpointManager; NMCheckpointManager *nm_checkpoint_manager_new (NMManager *manager, GParamSpec *spec); -void nm_checkpoint_manager_unref (NMCheckpointManager *self); + +void nm_checkpoint_manager_free (NMCheckpointManager *self); NMCheckpoint *nm_checkpoint_manager_create (NMCheckpointManager *self, const char *const*device_names, diff --git a/src/nm-manager.c b/src/nm-manager.c index 7629d0df34..4c4313a55a 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -6666,7 +6666,7 @@ dispose (GObject *object) if (priv->checkpoint_mgr) { nm_checkpoint_manager_destroy_all (priv->checkpoint_mgr, NULL); - g_clear_pointer (&priv->checkpoint_mgr, nm_checkpoint_manager_unref); + g_clear_pointer (&priv->checkpoint_mgr, nm_checkpoint_manager_free); } if (priv->auth_mgr) { |