[Xfce4-commits] <xfce4-xkb-plugin:master> Remove global tree_path variable and plug its leaking.

Jérôme Guelfucci noreply at xfce.org
Fri Apr 29 09:46:01 CEST 2011


Updating branch refs/heads/master
         to d50677feae43bfbbf73164632f82c72dd5bddb13 (commit)
       from 0c62d39ae74560e7e50daba4ab57edc1832d5ad2 (commit)

commit d50677feae43bfbbf73164632f82c72dd5bddb13
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Fri Apr 29 08:04:10 2011 +0200

    Remove global tree_path variable and plug its leaking.

 panel-plugin/xfce4-xkb-plugin.h    |    1 -
 panel-plugin/xkb-settings-dialog.c |    5 ++++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/xfce4-xkb-plugin.h b/panel-plugin/xfce4-xkb-plugin.h
index 9091d37..bf81b63 100644
--- a/panel-plugin/xfce4-xkb-plugin.h
+++ b/panel-plugin/xfce4-xkb-plugin.h
@@ -83,7 +83,6 @@ typedef struct
 GtkTreeIter iter, child;
 GtkTreeModel *model;
 GtkTreeSelection *selection;
-GtkTreePath *tree_path;
 
 /*
  * NOTE: The t_xkb->button_size field is due to xfce panel 4.4.1
diff --git a/panel-plugin/xkb-settings-dialog.c b/panel-plugin/xkb-settings-dialog.c
index 28ee9d4..211527b 100644
--- a/panel-plugin/xkb-settings-dialog.c
+++ b/panel-plugin/xkb-settings-dialog.c
@@ -812,6 +812,7 @@ xkb_settings_layout_dialog_run (void)
 
     if (response == GTK_RESPONSE_OK)
     {
+        GtkTreePath *tree_path;
         gchar *id;
         gchar *result;
 
@@ -821,7 +822,6 @@ xkb_settings_layout_dialog_run (void)
             return NULL;
         gtk_tree_model_get (model, &iter, AVAIL_LAYOUT_TREE_COL_ID, &id, -1);
 
-        /* TODO: tree_path must be leaked here... */
         tree_path = gtk_tree_model_get_path (model, &iter);
         if (gtk_tree_path_get_depth (tree_path) == 1)
             result = g_strconcat(id, ",", NULL);
@@ -832,12 +832,14 @@ xkb_settings_layout_dialog_run (void)
             if (!gtk_tree_path_up(tree_path))
             {
                 g_free (id);
+                gtk_tree_path_free (tree_path);
                 return NULL;
             }
 
             if (!gtk_tree_model_get_iter(model, &iter, tree_path))
             {
                 g_free (id);
+                gtk_tree_path_free (tree_path);
                 return NULL;
             }
 
@@ -848,6 +850,7 @@ xkb_settings_layout_dialog_run (void)
 
         gtk_widget_destroy (dialog);
         g_free (id);
+        gtk_tree_path_free (tree_path);
 
         return result;
     }



More information about the Xfce4-commits mailing list