summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <ross@linux.intel.com>2011-11-07 16:02:58 +0000
committerRoss Burton <ross@linux.intel.com>2011-11-07 16:04:02 +0000
commite6511a6bb4f7f68598b6fcc97ad38601dc5e4c6d (patch)
tree09465ebfc8270ac9863a0f7f021e42516bf250fb
parent950b2597003c6e6adc2ca1dfe1cc042c30489456 (diff)
Duplicate the file and path patterns
Now that we don't leak the GConfEntrys from startup, not duplicating them leads to hillarious memory corruption problems.
-rw-r--r--src/sj-main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/sj-main.c b/src/sj-main.c
index 1867e50..7f26df9 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -702,11 +702,15 @@ static void baseuri_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *
static void path_pattern_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
{
g_assert (strcmp (entry->key, GCONF_PATH_PATTERN) == 0);
+
+ if (path_pattern)
+ g_free (path_pattern);
+
if (entry->value == NULL) {
/* TODO: this value and the value in sj-prefs need to be in one place */
path_pattern = g_strdup ("%aa/%at");
} else {
- path_pattern = gconf_value_get_string (entry->value);
+ path_pattern = g_strdup (gconf_value_get_string (entry->value));
}
/* TODO: sanity check the pattern */
}
@@ -717,11 +721,15 @@ static void path_pattern_changed_cb (GConfClient *client, guint cnxn_id, GConfEn
static void file_pattern_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
{
g_assert (strcmp (entry->key, GCONF_FILE_PATTERN) == 0);
+
+ if (file_pattern)
+ g_free (file_pattern);
+
if (entry->value == NULL) {
/* TODO: this value and the value in sj-prefs need to be in one place */
file_pattern = g_strdup ("%tN-%tt");
} else {
- file_pattern = gconf_value_get_string (entry->value);
+ file_pattern = g_strdup (gconf_value_get_string (entry->value));
}
/* TODO: sanity check the pattern */
}