GNOME Bugzilla – Bug 679563
Properly annotate the GtkRadio* widgets
Last modified: 2015-03-07 20:12:02 UTC
The attached patch adds (allow-none) and (transfer container) annotations to the 'group' parameters of many methods of the GtkRadio* widgets.
Created attachment 218227 [details] [review] Properly annotate the GtkRadio* widgets The group GSList parameters that the constructors and the set_group() methods of GtkRadioAction, GtkRadioButton, GtkRadioMenuItem and GtkRadioToolButton receive are always (allow-none) and (transfer container).
Created attachment 218236 [details] [review] Properly annotate the GtkRadio* widgets The group GSList parameters that the constructors and the set_group() methods of GtkRadioAction, GtkRadioButton, GtkRadioMenuItem and GtkRadioToolButton receive are always (allow-none) and (transfer container). Also, the "_from_widget" constructors of GtkRadioMenuItem should allow NULL for the group member. Otherwise, there is no way to construct an initial item with the "_from_widget" constructors.
Ping.
Review of attachment 218236 [details] [review]: ::: gtk/gtkradioaction.c @@ +425,3 @@ * @action: the action object + * @group: (element-type GtkRadioAction) (transfer container) (allow-none): a + * list representing a radio group As far as I can see, the (allow-none) annotations are all correct, but I don't think the (transfer container) changes are: setters are never expected to consume caller's input, so those functions should all be (transfer none). You should also add an "or %NULL" snippet to the doc comment where it's missing. ::: gtk/gtkradiomenuitem.c @@ -239,3 @@ /** * gtk_radio_menu_item_new_with_label: - * @group: (element-type GtkRadioMenuItem) (transfer full): I think this (transfer full) annotation is just wrong.
(In reply to comment #4) > Review of attachment 218236 [details] [review]: > > ::: gtk/gtkradioaction.c > @@ +425,3 @@ > * @action: the action object > + * @group: (element-type GtkRadioAction) (transfer container) (allow-none): a > + * list representing a radio group > > As far as I can see, the (allow-none) annotations are all correct, but I don't > think the (transfer container) changes are: setters are never expected to > consume caller's input, so those functions should all be (transfer none). OK, I take back the "(transfer container)" proposal. But do note that "(transfer none)" is not entirely correct either: the GtkRadio* widgets assume that whatever you pass in will be valid for their lifetime. Under "(transfer none)", however, you should be allowed to free whatever you passed in; if gtkradio* wants to hang on to it, they should take a copy. But for now, I simply avoid the GSList-based API in the bindings. And I committed the non-controversial parts of the patch as 904bc272500b804e7868f7233883604d5778d133. What remains are the following changes to GtkRadioMenuItem.
Created attachment 263703 [details] [review] Allow NULLs
*** This bug has been marked as a duplicate of bug 671362 ***