[evolution-mapi] Fix few memory leaks around gtk_tree_view_new_with_model()



commit 5075940bf878321d680f034b4b9e8d5c30760994
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 4 14:12:18 2018 +0200

    Fix few memory leaks around gtk_tree_view_new_with_model()

 src/configuration/e-mapi-config-utils.c            | 1 +
 src/configuration/e-mapi-edit-folder-permissions.c | 6 ++++--
 src/configuration/e-mapi-search-gal-user.c         | 6 ++++--
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/configuration/e-mapi-config-utils.c b/src/configuration/e-mapi-config-utils.c
index 19cc8dd..cb579b0 100644
--- a/src/configuration/e-mapi-config-utils.c
+++ b/src/configuration/e-mapi-config-utils.c
@@ -1839,6 +1839,7 @@ e_mapi_config_utils_insert_widgets (ESourceConfigBackend *backend,
                gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
                g_object_set (tree_view, "expander-column", column, "headers-visible", TRUE, NULL);
                gtk_widget_set_sensitive (tree_view, is_new_source);
+               g_object_unref (tree_store);
 
                scrolled_window = gtk_scrolled_window_new (NULL, NULL);
                gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, 
GTK_POLICY_AUTOMATIC);
diff --git a/src/configuration/e-mapi-edit-folder-permissions.c 
b/src/configuration/e-mapi-edit-folder-permissions.c
index c8bb953..14d4440 100644
--- a/src/configuration/e-mapi-edit-folder-permissions.c
+++ b/src/configuration/e-mapi-edit-folder-permissions.c
@@ -863,6 +863,7 @@ create_permissions_tree_view (GObject *dialog,
                              struct EMapiPermissionsDialogWidgets *widgets)
 {
        GtkTreeView *tree_view;
+       GtkTreeModel *model;
        GtkTreeSelection *selection;
        GtkCellRenderer *renderer;
        GtkTreeViewColumn *column;
@@ -870,8 +871,9 @@ create_permissions_tree_view (GObject *dialog,
 
        g_return_val_if_fail (widgets != NULL, NULL);
 
-       tree_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (
-               GTK_TREE_MODEL (gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, 
G_TYPE_UINT, G_TYPE_BOOLEAN))));
+       model = GTK_TREE_MODEL (gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, 
G_TYPE_UINT, G_TYPE_BOOLEAN));
+       tree_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (model));
+       g_object_unref (model);
 
        renderer = gtk_cell_renderer_text_new ();
        g_object_set (renderer, "editable", FALSE, NULL);
diff --git a/src/configuration/e-mapi-search-gal-user.c b/src/configuration/e-mapi-search-gal-user.c
index 6fec1ca..ff31d9f 100644
--- a/src/configuration/e-mapi-search-gal-user.c
+++ b/src/configuration/e-mapi-search-gal-user.c
@@ -582,6 +582,7 @@ create_users_tree_view (GtkWidget *dialog,
                        struct EMapiSearchGalUserData *pgu)
 {
        GtkTreeView *tree_view;
+       GtkTreeModel *model;
        GtkTreeSelection *selection;
        GtkCellRenderer *renderer;
        GtkTreeViewColumn *column;
@@ -590,8 +591,9 @@ create_users_tree_view (GtkWidget *dialog,
        g_return_val_if_fail (dialog != NULL, NULL);
        g_return_val_if_fail (pgu != NULL, NULL);
 
-       tree_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (
-               GTK_TREE_MODEL (gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, 
G_TYPE_POINTER, G_TYPE_UINT))));
+       model = GTK_TREE_MODEL (gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, 
G_TYPE_POINTER, G_TYPE_UINT));
+       tree_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (model));
+       g_object_unref (model);
 
        renderer = gtk_cell_renderer_text_new ();
        g_object_set (renderer, "editable", FALSE, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]