summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-09-09 10:59:47 +0200
committerLubomir Rintel <lkundrak@v3.sk>2015-09-18 15:54:39 +0200
commitd20bed069c718e161f0a2457c9fb8204fc5c9fac (patch)
tree7d7b1cacd5f67c997af73c891ad115f83ee261fb
parent6c989bb68f3d182ec6e97e66c2f3faa25a0429b0 (diff)
downloadNetworkManager-d20bed069c718e161f0a2457c9fb8204fc5c9fac.tar.gz
libnm: fix initializing of new connections
connection_added() can be called before init_get_settings_cb(), and we can't complete the connection until it is visible, else it would be uninitialized. Test case: * have 'em1' interface $ nmcli con add type ethernet con-name myeth ifname em1 autoconnect no (process:9039): libnm-CRITICAL **: nm_connection_get_id: assertion 's_con != NULL' failed Connection '(null)' ((null)) successfully added. $ nmcli con add type ethernet con-name myeth ifname em1X autoconnect no Connection 'myeth' (71159504-c2af-4773-8ca9-a3626aa0da33) successfully added. https://bugzilla.gnome.org/show_bug.cgi?id=754767 https://bugzilla.gnome.org/show_bug.cgi?id=754794 [lkundrak@v3.sk: This is not quite the correct fix, we shouldn't emit NMObject:connection-added for an unfinished object. Nevertheless, let's go with it until we have a better one. Will revert this afterwards. See linked bugs.]
-rw-r--r--libnm/nm-remote-connection.c1
-rw-r--r--libnm/nm-remote-settings.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c
index e2073784ca..e5c5b99491 100644
--- a/libnm/nm-remote-connection.c
+++ b/libnm/nm-remote-connection.c
@@ -706,6 +706,7 @@ init_get_settings_cb (GObject *proxy,
priv->visible = TRUE;
replace_settings (init_data->connection, settings);
g_variant_unref (settings);
+ g_object_notify (init_data->connection, NM_REMOTE_CONNECTION_VISIBLE);
init_async_complete (init_data, NULL);
}
diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c
index 4d240e3b38..b25fa65983 100644
--- a/libnm/nm-remote-settings.c
+++ b/libnm/nm-remote-settings.c
@@ -237,8 +237,10 @@ connection_added (NMRemoteSettings *self,
if (nm_remote_connection_get_visible (remote))
g_ptr_array_add (priv->visible_connections, remote);
- else
+ else {
g_signal_stop_emission (self, signals[CONNECTION_ADDED], 0);
+ return;
+ }
path = nm_connection_get_path (NM_CONNECTION (remote));
addinfo = add_connection_info_find (self, path);