diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index 2125d66b69..652b856293 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -1023,6 +1023,7 @@ set_visible_child (GtkStack *stack, focus = gtk_window_get_focus (GTK_WINDOW (toplevel)); if (focus && priv->visible_child && + priv->visible_child->widget && gtk_widget_is_ancestor (focus, priv->visible_child->widget)) { contains_focus = TRUE;