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 741529 - child popover ownership issue with template and GtkMenuButton
child popover ownership issue with template and GtkMenuButton
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Class: GtkBuilder
3.15.x
Other Linux
: Normal normal
: ---
Assigned To: GtkBuilder maintainers
GtkBuilder maintainers
Depends on:
Blocks:
 
 
Reported: 2014-12-14 22:21 UTC by Christian Hergert
Modified: 2018-04-15 00:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Hergert 2014-12-14 22:21:54 UTC
I've noticed that the gtk_widget_destroy() process gets confused with my XML template. In the following situation, both my widget and the GtkMenuButton will try to call gtk_widget_destroy() on the popover.

1) create a generic container widget
2) outside the <template></template> create a GtkPopover with id="popover"
3) Assign the "popover" property of a GtkMenuButton in the template to "popover"

During the destroy cycle, gtk_widget_destroy() will be called twice for popover.

We might get around this by adding a child type="popover" or something for GtkMenuButton.
Comment 1 Matthias Clasen 2014-12-14 23:19:08 UTC
why would your widget destroy the popover ? Are you assigning it with gtk_widget_class_bind_template_child ?
Comment 2 Christian Hergert 2014-12-14 23:35:03 UTC
(In reply to comment #1)
> why would your widget destroy the popover ? Are you assigning it with
> gtk_widget_class_bind_template_child ?

That's correct. I need access to the popover so that can make some adjustments to it from the parent widget. (In particular, GtkMenuButton overrides "relative-to" when setting "popover", so have to fix that in code after loading the template to match the Builder search mockups).
Comment 3 Matthias Clasen 2014-12-21 03:51:46 UTC
Not seeing this in my test here. A testcase would help. But anyway, is this causing you a problem ? destroy handlers are typically written to be safe against being run twice.
Comment 4 Christian Hergert 2015-06-21 22:31:46 UTC
The test case for us in Builder is GbSearchBox (global search). We have a popover attached to a GtkMenuButton (with the down arrow), but we want the popover arrow to point at the GtkSearchEntry.

Doing this in data/ui/gb-search-box.ui like such:

  <object class="GtkPopover" id="popover">
    <property name="visible">true</property>
    <property name="modal">false</property>
    <property name="relative-to">entry</property>

results in the arrow still pointing at the menubutton. So in src/search/gb-search-box.c:337 (in ::constructed) we call:

  gtk_popover_set_relative_to (self->popover, GTK_WIDGET (self->entry));

Simply commenting out the above line results in the popover connected to the wrong widget despite being set in the ui definition.
Comment 5 Matthias Clasen 2018-02-10 05:21:26 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 6 Matthias Clasen 2018-04-15 00:25:17 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new