[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [oxygen-gtk/1.4] demo: Explicitly free tree path contained in list before freeing list, to prevent m
From:       Hugo Pereira Da Costa <hugo () oxygen-icons ! org>
Date:       2014-01-19 19:33:28
Message-ID: E1W4y7c-0003zM-V9 () scm ! kde ! org
[Download RAW message or body]

Git commit 2f6934f5bca361aa3da8115db208add5b5014da3 by Hugo Pereira Da Costa.
Committed on 17/01/2014 at 14:09.
Pushed by hpereiradacosta into branch '1.4'.

Explicitly free tree path contained in list before freeing list, to prevent mem leak
(somehow g_list_free does not free the content in this case)

M  +5    -0    demo/oxygendemodialog.cpp

http://commits.kde.org/oxygen-gtk/2f6934f5bca361aa3da8115db208add5b5014da3

diff --git a/demo/oxygendemodialog.cpp b/demo/oxygendemodialog.cpp
index bd648d3..12cb300 100644
--- a/demo/oxygendemodialog.cpp
+++ b/demo/oxygendemodialog.cpp
@@ -230,6 +230,11 @@ namespace Oxygen
         GtkTreePath* path( static_cast<GtkTreePath*>( g_list_first( selection )->data ) );
         const int page( gtk_tree_path_get_indices( path )[0] );
         gtk_notebook_set_current_page( GTK_NOTEBOOK( dialog._notebook ), page );
+
+        // explicitly free path contained in list to avoir mem leak, before calling g_list_free
+        for( GList *child = g_list_first( selection ); child; child = g_list_next( child ) )
+        { gtk_tree_path_free( static_cast<GtkTreePath*>( child->data ) ); }
+
         g_list_free( selection );
 
         // store enable state

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic