[geany/geany] a260a5: Merge pull request #1126 from b4n/plugin-key-group-strings-lifetime

Colomban Wendling git-noreply at xxxxx
Fri Jul 8 22:26:32 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Fri, 08 Jul 2016 22:26:32 UTC
Commit:      a260a5ac9ad7cdf915e6ee7578dce51787a8aac4
             https://github.com/geany/geany/commit/a260a5ac9ad7cdf915e6ee7578dce51787a8aac4

Log Message:
-----------
Merge pull request #1126 from b4n/plugin-key-group-strings-lifetime

Don't require plugin key group name and label strings to be static


Modified Paths:
--------------
    src/keybindings.c

Modified: src/keybindings.c
8 lines changed, 6 insertions(+), 2 deletions(-)
===================================================================
@@ -262,8 +262,9 @@ static void add_kb_group(GeanyKeyGroup *group,
 {
 	g_ptr_array_add(keybinding_groups, group);
 
-	group->name = name;
-	group->label = label;
+	/* as for items, we only require duplicated name and label for plugins */
+	group->name = plugin ? g_strdup(name) : name;
+	group->label = plugin ? g_strdup(label) : label;
 	group->callback = callback;
 	group->cb_func = NULL;
 	group->cb_data = NULL;
@@ -722,6 +723,9 @@ static void free_key_group(gpointer item)
 		if (group->cb_data_destroy)
 			group->cb_data_destroy(group->cb_data);
 		g_free(group->plugin_keys);
+		/* we allocated those in add_kb_group() as it's a plugin group */
+		g_free((gchar *) group->name);
+		g_free((gchar *) group->label);
 		g_free(group);
 	}
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list