[network-manager-applet] editor: avoid crash when connections become invisible
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] editor: avoid crash when connections become invisible
- Date: Mon, 16 Jan 2017 10:13:30 +0000 (UTC)
commit 6c5e2ac3b2bceffe064efde053e71fa6f6b7df30
Author: Beniamino Galvani <bgalvani redhat com>
Date: Wed Jan 11 10:17:35 2017 +0100
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
src/connection-editor/nm-connection-list.c | 12 +++++++++---
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 1ae111d..c1d8b11 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]