mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
gtk-demo: Fix crash after running popovers demo
The GtkBuilder window containing the complex popover UI was left dangling, and with a dangling pointer to its former child, causing crashes on gtk_grab_notify() after the popover was destroyed.
This commit is contained in:
parent
31042fe95f
commit
7e30b82aee
@ -35,14 +35,17 @@ static GtkWidget *
|
||||
create_complex_popover (GtkWidget *parent,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
GtkWidget *popover, *content;
|
||||
GtkWidget *popover, *window, *content;
|
||||
GtkBuilder *builder;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/popover/popover.ui", NULL);
|
||||
content = GTK_WIDGET (gtk_builder_get_object (builder, "box"));
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
content = gtk_bin_get_child (GTK_BIN (window));
|
||||
g_object_ref (content);
|
||||
gtk_widget_unparent (content);
|
||||
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (content)),
|
||||
content);
|
||||
gtk_widget_destroy (window);
|
||||
g_object_unref (builder);
|
||||
|
||||
popover = create_popover (parent, content, GTK_POS_BOTTOM);
|
||||
|
@ -40,7 +40,7 @@
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box">
|
||||
|
Loading…
Reference in New Issue
Block a user