From 71affbeec0cca2cd6a01069dfd1c414a0079179b Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 7 Oct 2013 13:46:16 +0100 Subject: [PATCH] stack: Warn when setting a visible child which is not in the stack https://bugzilla.gnome.org/show_bug.cgi?id=709613 --- gtk/gtkstack.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index 01e943e495..be4e0ff089 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -1278,7 +1278,11 @@ gtk_stack_set_visible_child (GtkStack *stack, child_info = find_child_info_for_widget (stack, child); if (child_info == NULL) - return; + { + g_warning ("Given child of type '%s' not found in GtkStack", + G_OBJECT_TYPE_NAME (child)); + return; + } if (gtk_widget_get_visible (child_info->widget)) set_visible_child (stack, child_info, @@ -1343,7 +1347,13 @@ gtk_stack_set_visible_child_full (GtkStack *stack, } } - if (child_info != NULL && gtk_widget_get_visible (child_info->widget)) + if (child_info == NULL) + { + g_warning ("Child name '%s' not found in GtkStack", name); + return; + } + + if (gtk_widget_get_visible (child_info->widget)) set_visible_child (stack, child_info, transition, priv->transition_duration); }