[gtk+/gtk-3-20] popover: set priv->window before setting doing add_popover() on it



commit 3270bdb98102523394a7d4c501f91a0a6ae8936e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat May 21 19:43:15 2016 +0200

    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

 gtk/gtkpopover.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index e496997..09e8c56 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1774,13 +1774,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_popover_update_position (popover);
+    {
+      _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));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]