Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Wed, 01 Jul 2015 21:03:38 UTC Commit: aa40250fdab5b1b5867b48a19d12c2a9cf2ecf7b https://github.com/geany/geany/commit/aa40250fdab5b1b5867b48a19d12c2a9cf2ecf...
Log Message: ----------- Fix invalid memory access when quitting
When quitting and the prefs dialog has been created, the StashPrefs are destroyed before the stash tree and so the stash tree cleanup code accesses freed memory. Fix this by removing access to the StashPref in the tree cleanup code, as fixing it properly is a bit of a mess.
Closes #538.
Modified Paths: -------------- src/stash.c
Modified: src/stash.c 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -979,7 +979,7 @@ struct StashTreeValue { const gchar *group_name; StashPref *pref; - union + struct { gchararray tree_string; gint tree_int; @@ -1075,8 +1075,8 @@ static gboolean stash_tree_discard_value(GtkTreeModel *model, GtkTreePath *path, StashTreeValue *value;
gtk_tree_model_get(model, iter, STASH_TREE_VALUE, &value, -1); - if (value->pref->setting_type == G_TYPE_STRING) - g_free(value->data.tree_string); + /* don't access value->pref as it might already have been freed */ + g_free(value->data.tree_string); g_free(value);
return FALSE;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).