diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2017-01-24 13:57:05 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-01-24 14:00:59 +0100 |
commit | f0e3dfdace25bf19c6a6b1f1cee4e384de64c433 (patch) | |
tree | f664ef2244a0b93eb2de1c49fddf11e1f18cd427 | |
parent | 9fff9f501ad984810b663d068c46b292fc9bc2a3 (diff) | |
download | NetworkManager-f0e3dfdace25bf19c6a6b1f1cee4e384de64c433.tar.gz |
active-connection: drop off the bus when the settings connection disappears
The active connection has an immutable connection property, but is
cleaned asynchronously by the manager after its settings connection is
done. Fine, let's remove it from the bus first though, so that we don't
hang there with a dangling object path.
-rw-r--r-- | src/nm-active-connection.c | 15 | ||||
-rw-r--r-- | src/settings/nm-settings.c | 6 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 17fb82e50a..625c19e838 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -157,6 +157,20 @@ _settings_connection_updated (NMSettingsConnection *connection, } static void +_settings_connection_removed (NMSettingsConnection *connection, + gpointer user_data) +{ + NMActiveConnection *self = user_data; + + /* Our settings connection is about to drop off. The next active connection + * cleanup is going to tear us down (at least until we grow the capability to + * re-link; in that case we'd just clean the references to the old connection here). + * Let's remove ourselves from the bus so that we're not exposed with a dangling + * reference to the setting connection once it's gone. */ + nm_exported_object_unexport (NM_EXPORTED_OBJECT (self)); +} + +static void _set_settings_connection (NMActiveConnection *self, NMSettingsConnection *connection) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); @@ -170,6 +184,7 @@ _set_settings_connection (NMActiveConnection *self, NMSettingsConnection *connec if (connection) { priv->settings_connection = g_object_ref (connection); g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, (GCallback) _settings_connection_updated, self); + g_signal_connect (connection, NM_SETTINGS_CONNECTION_REMOVED, (GCallback) _settings_connection_removed, self); } } diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index 6a920d5cf4..35790a1264 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -1112,8 +1112,10 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection) openconnect_migrate_hack (NM_CONNECTION (connection)); g_object_ref (self); - g_signal_connect (connection, NM_SETTINGS_CONNECTION_REMOVED, - G_CALLBACK (connection_removed), self); + /* This one unexports the connection, it needs to run late to give the active + * connection a chance to deal with its reference to this settings connection. */ + g_signal_connect_after (connection, NM_SETTINGS_CONNECTION_REMOVED, + G_CALLBACK (connection_removed), self); g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL, G_CALLBACK (connection_updated), self); g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_VISIBLE, |