[evolution] ESourceSelector: Fix a reference leak in text_cell_edited_cb().



commit 9009fc58c48a7f415687076577c1598182c18e75
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Oct 25 11:53:11 2013 -0400

    ESourceSelector: Fix a reference leak in text_cell_edited_cb().
    
    We were leaking the ESource reference.

 e-util/e-source-selector.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/e-util/e-source-selector.c b/e-util/e-source-selector.c
index 71c902c..2044d5f 100644
--- a/e-util/e-source-selector.c
+++ b/e-util/e-source-selector.c
@@ -561,23 +561,25 @@ text_cell_edited_cb (ESourceSelector *selector,
        GtkTreeIter iter;
        ESource *source;
 
+       if (new_name == NULL || *new_name == '\0')
+               return;
+
+       if (same_source_name_exists (selector, new_name))
+               return;
+
        tree_view = GTK_TREE_VIEW (selector);
        model = gtk_tree_view_get_model (tree_view);
-       path = gtk_tree_path_new_from_string (path_string);
 
+       path = gtk_tree_path_new_from_string (path_string);
        gtk_tree_model_get_iter (model, &iter, path);
        gtk_tree_model_get (model, &iter, COLUMN_SOURCE, &source, -1);
        gtk_tree_path_free (path);
 
-       if (new_name == NULL || *new_name == '\0')
-               return;
-
-       if (same_source_name_exists (selector, new_name))
-               return;
-
        e_source_set_display_name (source, new_name);
 
        e_source_selector_queue_write (selector, source);
+
+       g_object_unref (source);
 }
 
 static void


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