[network-manager-applet/th/tmp: 7/8] c-e: take reference to connection for active_editors



commit f257beefd244d2e092d6884982f5e5ddfc33b1f3
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]