summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-26 15:43:57 +0200
committerThomas Haller <thaller@redhat.com>2016-04-26 15:48:20 +0200
commit767fa0ed3d6e340362c5cbbfce7e7b0300b61857 (patch)
tree64983981ee93b0930d4db36e020987e3c52ca20a
parent87ded996111603350c647f6e41dd74e7857884b5 (diff)
downloadNetworkManager-767fa0ed3d6e340362c5cbbfce7e7b0300b61857.tar.gz
settings: disconnect connection_ready_changed() handler when reaching startup_complete
We connect to notify::startup-complete signal of each connection, but after we signal startup-complete once, we don't need that signal anymore. Disconnect.
-rw-r--r--src/settings/nm-settings.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index 3b8ac5b5df..1f4882305d 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -134,6 +134,10 @@ static void unrecognized_specs_changed (NMSettingsPlugin *config, gpointer user_
static void connection_provider_iface_init (NMConnectionProviderInterface *cp_iface);
+static void connection_ready_changed (NMSettingsConnection *conn,
+ GParamSpec *pspec,
+ gpointer user_data);
+
G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT, 0,
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION_PROVIDER, connection_provider_iface_init))
@@ -204,6 +208,11 @@ check_startup_complete (NMSettings *self)
return;
}
+ /* the connection_ready_changed signal handler is no longer needed. */
+ g_hash_table_iter_init (&iter, priv->connections);
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &conn))
+ g_signal_handlers_disconnect_by_func (conn, G_CALLBACK (connection_ready_changed), self);
+
priv->startup_complete = TRUE;
_notify (self, PROP_STARTUP_COMPLETE);
}
@@ -274,7 +283,7 @@ nm_settings_for_each_connection (NMSettings *self,
g_return_if_fail (NM_IS_SETTINGS (self));
g_return_if_fail (for_each_func != NULL);
-
+
priv = NM_SETTINGS_GET_PRIVATE (self);
g_hash_table_iter_init (&iter, priv->connections);
@@ -918,7 +927,8 @@ connection_removed (NMSettingsConnection *connection, gpointer user_data)
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_removed), self);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_updated), self);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_visibility_changed), self);
- g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_ready_changed), self);
+ if (!priv->startup_complete)
+ g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_ready_changed), self);
g_object_unref (self);
/* Forget about the connection internally */