mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 05:58:01 +02:00
core: add and use nm_keep_alive_destroy()
When we are done with a NMKeepAlive instance, we always should do three things: - unset the owner - disarm (freeze) the keep-alive - give up our reference. Add and use nm_keep_alive_destroy() that does this.
This commit is contained in:
parent
dd5c88b1cc
commit
8a8e894f80
3 changed files with 23 additions and 2 deletions
|
|
@ -1533,8 +1533,7 @@ finalize (GObject *object)
|
||||||
|
|
||||||
nm_dbus_track_obj_path_set (&priv->settings_connection, NULL, FALSE);
|
nm_dbus_track_obj_path_set (&priv->settings_connection, NULL, FALSE);
|
||||||
|
|
||||||
_nm_keep_alive_set_owner (priv->keep_alive, NULL);
|
nm_clear_pointer (&priv->keep_alive, nm_keep_alive_destroy);
|
||||||
g_clear_object (&priv->keep_alive);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_active_connection_parent_class)->finalize (object);
|
G_OBJECT_CLASS (nm_active_connection_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,26 @@ nm_keep_alive_disarm (NMKeepAlive *self)
|
||||||
cleanup_dbus_watch (self);
|
cleanup_dbus_watch (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nm_keep_alive_destroy:
|
||||||
|
* @self: (allow-none): the #NMKeepAlive instance to destroy.
|
||||||
|
*
|
||||||
|
* This does 3 things in one:
|
||||||
|
*
|
||||||
|
* - set owner to %NULL
|
||||||
|
* - disarm the instance.
|
||||||
|
* - unref @self.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
nm_keep_alive_destroy (NMKeepAlive *self)
|
||||||
|
{
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
_nm_keep_alive_set_owner (self, NULL);
|
||||||
|
nm_keep_alive_disarm (self);
|
||||||
|
g_object_unref (self);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ gboolean nm_keep_alive_is_alive (NMKeepAlive *self);
|
||||||
void nm_keep_alive_arm (NMKeepAlive *self);
|
void nm_keep_alive_arm (NMKeepAlive *self);
|
||||||
void nm_keep_alive_disarm (NMKeepAlive *self);
|
void nm_keep_alive_disarm (NMKeepAlive *self);
|
||||||
|
|
||||||
|
void nm_keep_alive_destroy (NMKeepAlive *self);
|
||||||
|
|
||||||
void nm_keep_alive_set_settings_connection_watch_visible (NMKeepAlive *self,
|
void nm_keep_alive_set_settings_connection_watch_visible (NMKeepAlive *self,
|
||||||
NMSettingsConnection *connection);
|
NMSettingsConnection *connection);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue