How to commit a fix to the gtkpod repository?
Javier Kohen <[email protected]> Mon, 23 Jan 2012 20:57:43 +0100
| Newsgroups | gmane.comp.ipod.gtkpod |
|---|---|
| Message-ID | <CA+JJWcyvKt4f+eFpdcOxgwUvKMR1++Aqs6=F+qM9y0U6eYFVgg@mail.gmail.com> |
I have write access to the repository, but I don't understand how it's organized. I noticed that the latest change commited to HEAD is from September, but there are tags with commits from two weeks ago. Namely gtkpod-2.1.1. Where should fixes go? The problem I'm trying to fix is that gtkpod crashes when adding folders due to imaginative memory management. I'm attaching the patch to fix it, in case anybody's hurrying to get the fix. ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Gtkpod-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gtkpod-devel
0001-Fixed-memory-management-in-recurse_directories_inter.patch
(text/x-patch, 2 KB)
From f25a92d2396cccb4e96ee21af464c7cad4d70516 Mon Sep 17 00:00:00 2001 From: Javier Kohen <[email protected]> Date: Mon, 23 Jan 2012 20:55:32 +0100 Subject: [PATCH] Fixed memory management in recurse_directories_internal. --- libgtkpod/file.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libgtkpod/file.c b/libgtkpod/file.c index 7f3b3cc..51cbd4c 100644 --- a/libgtkpod/file.c +++ b/libgtkpod/file.c @@ -420,10 +420,15 @@ static void recurse_directories_internal(gchar *name, GSList **trknames, gboolea nextfull = basepath; } - if (g_hash_table_lookup(*directories_seen, nextfull)) + if (g_hash_table_lookup(*directories_seen, nextfull)) { continue; - else - g_hash_table_insert(*directories_seen, nextfull, nextfull); + } else { + /* The hash table is set-up to free the key, + * but not the value, so we can pass a single + * newly allocated string for both. */ + const gchar *key = g_strdup(nextfull); + g_hash_table_insert(*directories_seen, key, key); + } if (descend || !g_file_test(nextfull, G_FILE_TEST_IS_DIR)) { recurse_directories_internal(nextfull, trknames, descend, directories_seen); @@ -453,7 +458,8 @@ static void recurse_directories_internal(gchar *name, GSList **trknames, gboolea * FALSE: don't enter subdirectories */ static void recurse_directories_with_history(gchar *dir, GSList **trknames, gboolean descend) { - GHashTable *directories = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + /* Delete keys but not values. Users will set both to the same string. */ + GHashTable *directories = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); recurse_directories_internal(dir, trknames, descend, &directories); g_hash_table_destroy(directories); } -- 1.7.8.3