[gtk+] Don't prematurely mark window as realized
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Don't prematurely mark window as realized
- Date: Fri, 5 Jul 2013 21:17:18 +0000 (UTC)
commit ffadfbf322cf392dc55b69bc8a4c70bd5839aa1b
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 5 17:15:31 2013 -0400
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.
gtk/gtkwindow.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 73e75a4..521b389 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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;
}
@@ -5760,9 +5759,7 @@ 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]