Commit bec6b260 authored by Matthias Clasen's avatar Matthias Clasen

Be robust against unrealized windows in GtkWindowAccessible

Based on a patch by Albert Astals Cid,
https://bugzilla.gnome.org/show_bug.cgi?id=686152
parent c51157d4
......@@ -262,7 +262,7 @@ gtk_window_accessible_ref_state_set (AtkObject *accessible)
atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
gdk_window = gtk_widget_get_window (widget);
if (window)
if (gdk_window)
{
state = gdk_window_get_state (gdk_window);
if (state & GDK_WINDOW_STATE_ICONIFIED)
......@@ -307,6 +307,7 @@ gtk_window_accessible_get_extents (AtkComponent *component,
AtkCoordType coord_type)
{
GtkWidget *widget;
GdkWindow *window;
GdkRectangle rect;
gint x_toplevel, y_toplevel;
......@@ -323,7 +324,11 @@ gtk_window_accessible_get_extents (AtkComponent *component,
return;
}
gdk_window_get_frame_extents (gtk_widget_get_window (widget), &rect);
window = gtk_widget_get_window (widget);
if (window == NULL)
return;
gdk_window_get_frame_extents (window, &rect);
*width = rect.width;
*height = rect.height;
......@@ -338,8 +343,7 @@ gtk_window_accessible_get_extents (AtkComponent *component,
*y = rect.y;
if (coord_type == ATK_XY_WINDOW)
{
gdk_window_get_origin (gtk_widget_get_window (widget),
&x_toplevel, &y_toplevel);
gdk_window_get_origin (window, &x_toplevel, &y_toplevel);
*x -= x_toplevel;
*y -= y_toplevel;
}
......@@ -351,6 +355,7 @@ gtk_window_accessible_get_size (AtkComponent *component,
gint *height)
{
GtkWidget *widget;
GdkWindow *window;
GdkRectangle rect;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component));
......@@ -366,7 +371,11 @@ gtk_window_accessible_get_size (AtkComponent *component,
return;
}
gdk_window_get_frame_extents (gtk_widget_get_window (widget), &rect);
window = gtk_widget_get_window (widget);
if (window == NULL)
return;
gdk_window_get_frame_extents (window, &rect);
*width = rect.width;
*height = rect.height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment