Don't prematurely mark window as realized
Other code assumes that the widget has a window if it is realized. Since we might trigger such code indirectly from gtk_window_realize, don't mark the window as realized before we've registered its window.
This commit is contained in:
		@ -5708,8 +5708,6 @@ gtk_window_realize (GtkWidget *widget)
 | 
			
		||||
    {
 | 
			
		||||
      gtk_container_set_resize_mode (GTK_CONTAINER (widget), GTK_RESIZE_PARENT);
 | 
			
		||||
 | 
			
		||||
      gtk_widget_set_realized (widget, TRUE);
 | 
			
		||||
 | 
			
		||||
      attributes.x = allocation.x;
 | 
			
		||||
      attributes.y = allocation.y;
 | 
			
		||||
      attributes.width = allocation.width;
 | 
			
		||||
@ -5727,6 +5725,7 @@ gtk_window_realize (GtkWidget *widget)
 | 
			
		||||
				   &attributes, attributes_mask);
 | 
			
		||||
      gtk_widget_set_window (widget, gdk_window);
 | 
			
		||||
      gtk_widget_register_window (widget, gdk_window);
 | 
			
		||||
      gtk_widget_set_realized (widget, TRUE);
 | 
			
		||||
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
@ -5761,8 +5760,6 @@ gtk_window_realize (GtkWidget *widget)
 | 
			
		||||
      g_return_if_fail (!gtk_widget_get_realized (widget));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  gtk_widget_set_realized (widget, TRUE);
 | 
			
		||||
  
 | 
			
		||||
  switch (priv->type)
 | 
			
		||||
    {
 | 
			
		||||
    case GTK_WINDOW_TOPLEVEL:
 | 
			
		||||
@ -5811,6 +5808,7 @@ gtk_window_realize (GtkWidget *widget)
 | 
			
		||||
  gdk_window = gdk_window_new (parent_window, &attributes, attributes_mask);
 | 
			
		||||
  gtk_widget_set_window (widget, gdk_window);
 | 
			
		||||
  gtk_widget_register_window (widget, gdk_window);
 | 
			
		||||
  gtk_widget_set_realized (widget, TRUE);
 | 
			
		||||
 | 
			
		||||
  /* We don't need to set a background on the GdkWindow; with decorations
 | 
			
		||||
   * we draw the background ourself
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user