settings: fix clearing agent-manager in NMSettings' dispose()

dispose() should be re-entrant. When releasing a resource, it must not
leave a dangling pointer. While at it, just move it to finalize() instead.
This commit is contained in:
Thomas Haller 2018-04-13 10:31:07 +02:00
parent a92543d3b7
commit e41db3fa55

View file

@ -1915,8 +1915,6 @@ dispose (GObject *object)
g_slist_free_full (priv->auths, (GDestroyNotify) nm_auth_chain_destroy);
priv->auths = NULL;
g_object_unref (priv->agent_mgr);
if (priv->hostname_manager) {
g_signal_handlers_disconnect_by_func (priv->hostname_manager,
G_CALLBACK (_hostname_changed_cb),
@ -1942,6 +1940,8 @@ finalize (GObject *object)
g_slist_free_full (priv->plugins, g_object_unref);
g_clear_object (&priv->agent_mgr);
g_clear_object (&priv->config);
G_OBJECT_CLASS (nm_settings_parent_class)->finalize (object);