diff options
author | Thomas Haller <thaller@redhat.com> | 2018-03-29 15:01:11 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-04-13 09:09:46 +0200 |
commit | 1f3b47deea84888813ed482f5b3e75292b0f2726 (patch) | |
tree | 9d162e894d12ea99ea97b6bb3d87ccfd7c7e6cb6 | |
parent | ebd53888b6d2c2890f68e0013e15c46cd1239577 (diff) | |
download | NetworkManager-1f3b47deea84888813ed482f5b3e75292b0f2726.tar.gz |
settings: reorder D-Bus events when removing settings-connection
It makes more sense to me this way.
-rw-r--r-- | src/settings/nm-settings.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index dfaf517fc5..e3a9fd4c19 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -849,32 +849,16 @@ connection_flags_changed (NMSettingsConnection *connection, } static void -_emit_connection_removed (NMSettings *self, - NMSettingsConnection *connection) -{ - nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self), - &interface_info_settings, - &signal_info_connection_removed, - "(o)", - nm_dbus_object_get_path (NM_DBUS_OBJECT (connection))); - - g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connection); -} - -static void connection_removed (NMSettingsConnection *connection, gpointer user_data) { NMSettings *self = NM_SETTINGS (user_data); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); const char *cpath = nm_dbus_object_get_path (NM_DBUS_OBJECT (connection)); NMDevice *device; - _nm_unused gs_unref_object NMSettingsConnection *connection_keep_alive = NULL; if (!g_hash_table_lookup (priv->connections, cpath)) g_return_if_reached (); - connection_keep_alive = g_object_ref (connection); - /* When the default wired connection is removed (either deleted or saved to * a new persistent connection by a plugin), write the MAC address of the * wired device to the config file and don't create a new default wired @@ -896,16 +880,27 @@ connection_removed (NMSettingsConnection *connection, gpointer user_data) g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_ready_changed), self); g_object_unref (self); - /* Forget about the connection internally */ - g_hash_table_remove (priv->connections, (gpointer) cpath); _clear_connections_cached_list (&priv->connections_cached_list); - _emit_connection_removed (self, connection); + /* we unref @connection below. */ + g_hash_table_steal (priv->connections, (gpointer) cpath); - /* Re-emit for listeners like NMPolicy */ - _notify (self, PROP_CONNECTIONS); - if (nm_dbus_object_is_exported (NM_DBUS_OBJECT (connection))) - nm_dbus_object_unexport (NM_DBUS_OBJECT (connection)); + if (priv->connections_loaded) { + _notify (self, PROP_CONNECTIONS); + + nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self), + &interface_info_settings, + &signal_info_connection_removed, + "(o)", + nm_dbus_object_get_path (NM_DBUS_OBJECT (connection))); + } + + nm_dbus_object_unexport (NM_DBUS_OBJECT (connection)); + + if (priv->connections_loaded) + g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connection); + + g_object_ref (connection); check_startup_complete (self); } |