summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-01-11 10:17:35 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-01-16 11:04:30 +0100
commit6c5e2ac3b2bceffe064efde053e71fa6f6b7df30 (patch)
tree661e2afc12913fa0ff71b2095d65f7ded8e3264a
parent6f0941ef26ae1ddf1403c5728b5840603b0d165e (diff)
downloadnetwork-manager-applet-6c5e2ac3b2bceffe064efde053e71fa6f6b7df30.tar.gz
editor: avoid crash when connections become invisible
Connections that become invisible initially emit a CHANGED signal when their settings are removed and then they will disappear. Ignore invisible connections and ones that are still visible but don't have a NMSettingConnection since they are being removed. https://bugzilla.redhat.com/show_bug.cgi?id=1410742
-rw-r--r--src/connection-editor/nm-connection-list.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 1ae111d8..c1d8b11c 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -558,7 +558,7 @@ tree_model_visible_func (GtkTreeModel *model,
gpointer user_data)
{
NMConnectionList *self = user_data;
- NMConnection *connection;
+ gs_unref_object NMConnection *connection = NULL;
NMSettingConnection *s_con;
const char *master;
const char *slave_type;
@@ -573,8 +573,9 @@ tree_model_visible_func (GtkTreeModel *model,
* bond or team or bridge.
*/
s_con = nm_connection_get_setting_connection (connection);
- g_object_unref (connection);
- g_return_val_if_fail (s_con != NULL, FALSE);
+ if ( !s_con
+ || !nm_remote_connection_get_visible (NM_REMOTE_CONNECTION (connection)))
+ return FALSE;
master = nm_setting_connection_get_master (s_con);
if (!master)
@@ -749,6 +750,11 @@ connection_changed (NMRemoteConnection *connection, gpointer user_data)
NMConnectionList *self = NM_CONNECTION_LIST (user_data);
GtkTreeIter iter;
+ if ( !nm_remote_connection_get_visible (connection)
+ || !nm_connection_get_setting_connection (NM_CONNECTION (connection))) {
+ return;
+ }
+
if (get_iter_for_connection (self, connection, &iter))
update_connection_row (self, &iter, connection);
}