GNOME Bugzilla – Bug 618571
Add gtk_radio_action_join_group method
Last modified: 2010-05-19 19:18:29 UTC
The current way to set a radio action as part of a group is to get the group from an action currently in the group and then setting that group on the action. Because group is just a GSList containing all of the actions in the group, we run into reffing (ownership) issues in GI generated bindings causing segfaults. Basically the list gets changed out from underneath the bindings when set_group is called causing issues later in the code. join_group fixes this by keeping the group list internal when adding an action to a group. It takes two actions (the second can be NULL) and adds the first action to the second action's group. Since the bindings never see the group list it never has to deal with ownership issues for object in the list.
Created attachment 161005 [details] [review] [PATCH] add the binding friendly join_group method to GtkRadioAction * Due to object ownership issues it is imposible to correctly use get_group/set_group from a GI binding * join_group is safer because at the binding level it works with indvidual GtkRadioAction objects and not with the list of objects that gets modified in the library --- docs/reference/gtk/gtk3-sections.txt | 1 + docs/reference/gtk/tmpl/gtkradioaction.sgml | 9 +++++ gtk/gtk.symbols | 1 + gtk/gtkradioaction.c | 53 +++++++++++++++++++++++++++ gtk/gtkradioaction.h | 2 + 5 files changed, 66 insertions(+), 0 deletions(-)
Created attachment 161006 [details] [review] [PATCH] add the binding friendly join_group method to GtkRadioAction * Due to object ownership issues it is impossible to correctly use get_group/set_group from a GI binding * join_group is safer because at the binding level it works with individual GtkRadioAction objects and not with the list of objects that gets modified in the library --- docs/reference/gtk/gtk3-sections.txt | 1 + docs/reference/gtk/tmpl/gtkradioaction.sgml | 9 +++++ gtk/gtk.symbols | 1 + gtk/gtkradioaction.c | 53 +++++++++++++++++++++++++++ gtk/gtkradioaction.h | 2 + 5 files changed, 66 insertions(+), 0 deletions(-)
fixed some spelling mistakes in the commit log
Review of attachment 161006 [details] [review]: Looks like an ok api addition to me, in general. ::: gtk/gtkradioaction.c @@ +460,3 @@ + * gtk_radio_action_join_group: + * @action: the action object + * @group_source: (allow-none): a radio action object whos group we are joining Should say ", or %NULL to remove the radio action from its group" here @@ +464,3 @@ + * Joins a radio action object to the group of another radio action object. + * + * Use this in GI scripting languages instead of the get_group and set_group method Please use full function names with () here, to get proper links in the generated docs. And I would prefer 'language bindings' over 'GI scripting languages'.