After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 724407 - Fix critical warning when using GtkMenuButton with popover
Fix critical warning when using GtkMenuButton with popover
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-02-15 10:38 UTC by Paolo Borelli
Modified: 2014-02-19 23:02 UTC
See Also:
GNOME target: 3.12
GNOME version: ---


Attachments
patch (870 bytes, patch)
2014-02-15 10:39 UTC, Paolo Borelli
none Details | Review
popover: Accept NULL relative_to widgets (3.07 KB, patch)
2014-02-18 14:05 UTC, Carlos Garnacho
committed Details | Review

Description Paolo Borelli 2014-02-15 10:38:25 UTC
Either the attached patch or popover_set_relative_to should be changed and annotated to accept null
Comment 1 Paolo Borelli 2014-02-15 10:39:00 UTC
Created attachment 269192 [details] [review]
patch
Comment 2 Carlos Garnacho 2014-02-18 14:05:30 UTC
Created attachment 269551 [details] [review]
popover: Accept NULL relative_to widgets

And document the fact that the popover will get destroyed if
a NULL relative-to is given on a parented popover, if no extra
references are kept.

For gtk_popover_new*(), a NULL relative-to will leave the widget
as a floating object, to be sunk by a later call to
gtk_widget_set_relative_to().
Comment 3 Carlos Garnacho 2014-02-18 14:13:29 UTC
Being the popover lifetime so attached to its relative-to widget, I was at first hesitant about allowing none there, but seeing how it's being practically used on GtkMenuButton, it wouldn't have such a different semantics from gtk_menu_attach/detach in the end, just that it's comprised in a single call here. And this looks like it could be a common usage pattern, so I guess it's best to just document the oddities and at least allow widgets to do this.
Comment 4 Matthias Clasen 2014-02-18 21:10:49 UTC
Review of attachment 269551 [details] [review]:

other than that, I agree with this patch

::: gtk/gtkpopover.c
@@ +1632,3 @@
+ * widget, so if @relative_to is set to %NULL on an attached @popover, it
+ * will be detached from its previous widget, and consequently destroyed
+ * unless extra references are kept.

Might be good to have a similar note for gtk_popover_new, explaining that the returned reference is already owned by @relative_to ?
Comment 5 Paolo Borelli 2014-02-18 21:24:13 UTC
Review of attachment 269551 [details] [review]:

::: gtk/gtkpopover.c
@@ +1632,3 @@
+ * widget, so if @relative_to is set to %NULL on an attached @popover, it
+ * will be detached from its previous widget, and consequently destroyed
+ * unless extra references are kept.

that's quite unusual in gtk, maybe it is more clear to drop the relative_to arg in new() ?
It is slightly less convenient in C, but I think it would less "special"
Comment 6 Matthias Clasen 2014-02-19 05:32:55 UTC
Comment on attachment 269551 [details] [review]
popover: Accept NULL relative_to widgets

Attachment 269551 [details] pushed as 63bb834 - popover: Accept NULL relative_to widgets