popover: set priv->window before setting doing add_popover() on it

If the popover's relative-to widget is unparented/reparented, we end
up unparenting/reparenting the popover as well. In that case, at the
moment of reparenting, the widget might have been visible (and is
thus mapped again), but priv->window hasn't been set yet.

We must first set priv->window, and then call gtk_window_add_popover(),
that way gtk_popover_map() has its prerequisites straight.

https://bugzilla.gnome.org/show_bug.cgi?id=766323
This commit is contained in:
Carlos Garnacho 2016-05-21 19:43:15 +02:00
parent ebf703ff5a
commit 76a5e3fc3c

View File

@ -1755,13 +1755,13 @@ _gtk_popover_parent_hierarchy_changed (GtkWidget *widget,
if (priv->window)
_gtk_window_remove_popover (priv->window, GTK_WIDGET (popover));
if (new_window)
_gtk_window_add_popover (new_window, GTK_WIDGET (popover), priv->widget, TRUE);
priv->window = new_window;
if (new_window)
{
_gtk_window_add_popover (new_window, GTK_WIDGET (popover), priv->widget, TRUE);
gtk_popover_update_position (popover);
}
if (gtk_widget_is_visible (GTK_WIDGET (popover)))
gtk_widget_queue_resize (GTK_WIDGET (popover));