summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-11-11 17:02:36 +0100
committerThomas Haller <thaller@redhat.com>2016-11-22 11:47:29 +0100
commit6845058c39e70c7d61bdfddfa860fb4955bc2335 (patch)
treebb576e99aaa7cfe6110973fc1799210eafa830fe
parenta300093f8f219311ebae3241b491d333d3ca3816 (diff)
downloadnetwork-manager-applet-6845058c39e70c7d61bdfddfa860fb4955bc2335.tar.gz
c-e: take reference to connection for active_editors
-rw-r--r--src/connection-editor/nm-connection-editor.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 85fc8ff5..281cc475 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -424,8 +424,8 @@ nm_connection_editor_new (GtkWindow *parent_window,
}
if (!active_editors)
- active_editors = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (active_editors, connection, editor);
+ active_editors = g_hash_table_new_full (NULL, NULL, g_object_unref, NULL);
+ g_hash_table_insert (active_editors, g_object_ref (connection), editor);
return editor;
}
@@ -433,10 +433,7 @@ nm_connection_editor_new (GtkWindow *parent_window,
NMConnectionEditor *
nm_connection_editor_get (NMConnection *connection)
{
- if (!active_editors)
- return NULL;
-
- return g_hash_table_lookup (active_editors, connection);
+ return active_editors ? g_hash_table_lookup (active_editors, connection) : NULL;
}
/* Returns an editor for @slave's master, if any */