summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-21 18:16:05 +0200
committerThomas Haller <thaller@redhat.com>2016-04-26 10:45:44 +0200
commit6e946b366376491434f2e9fa9aba164b2c2a235a (patch)
treeceec02e3c35f7596eb65d2d1e54b7b3d1fed62ca
parent6bc312ed5e810b0681d5719556fac2d9262cec69 (diff)
downloadNetworkManager-6e946b366376491434f2e9fa9aba164b2c2a235a.tar.gz
dns: when clearing "plugin" always disconnect signal handlers
-rw-r--r--src/dns-manager/nm-dns-manager.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c
index fe72f3c9a4..7556fcbca2 100644
--- a/src/dns-manager/nm-dns-manager.c
+++ b/src/dns-manager/nm-dns-manager.c
@@ -1418,6 +1418,18 @@ nm_dns_manager_end_updates (NMDnsManager *self, const char *func)
/******************************************************************/
+static void
+_clear_plugin (NMDnsManager *self)
+{
+ NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self);
+
+ if (priv->plugin) {
+ g_signal_handlers_disconnect_by_func (priv->plugin, plugin_failed, self);
+ g_signal_handlers_disconnect_by_func (priv->plugin, plugin_child_quit, self);
+ g_clear_object (&priv->plugin);
+ }
+}
+
static NMDnsManagerResolvConfManager
_get_resolv_conf_manager_default (void)
{
@@ -1509,7 +1521,7 @@ init_resolv_conf_mode (NMDnsManager *self)
g_free (priv->last_mode);
priv->last_mode = g_strdup (mode);
priv->last_immutable = FALSE;
- g_clear_object (&priv->plugin);
+ _clear_plugin (self);
priv->resolv_conf_mode = NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED;
if (nm_streq0 (mode, "none")) {
@@ -1612,11 +1624,7 @@ dispose (GObject *object)
_LOGT ("disposing");
- if (priv->plugin) {
- g_signal_handlers_disconnect_by_func (priv->plugin, plugin_failed, self);
- g_signal_handlers_disconnect_by_func (priv->plugin, plugin_child_quit, self);
- g_clear_object (&priv->plugin);
- }
+ _clear_plugin (self);
g_clear_pointer (&priv->last_mode, g_free);