From 45c24fb9397d49c08a6d37b8ddcc7c06a5af0b58 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 27 Mar 2018 16:13:17 +0200 Subject: 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". --- src/nm-checkpoint-manager.c | 2 +- src/nm-checkpoint-manager.h | 3 ++- 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) { -- cgit v1.2.1