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.]
This commit is contained in:

committed by
Lubomir Rintel

parent
6c989bb68f
commit
d20bed069c
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user