[network-manager-applet/th/c-e-import-fixes-bgo774290: 7/10] c-e: take reference to connection for active_editors
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/th/c-e-import-fixes-bgo774290: 7/10] c-e: take reference to connection for active_editors
- Date: Tue, 22 Nov 2016 10:48:43 +0000 (UTC)
commit 6845058c39e70c7d61bdfddfa860fb4955bc2335
Author: Thomas Haller <thaller redhat com>
Date: Fri Nov 11 17:02:36 2016 +0100
c-e: take reference to connection for active_editors
src/connection-editor/nm-connection-editor.c | 9 +++------
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 85fc8ff..281cc47 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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]