[gtk+] stack: Warn when setting a visible child which is not in the stack
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] stack: Warn when setting a visible child which is not in the stack
- Date: Wed, 9 Oct 2013 11:13:11 +0000 (UTC)
commit 5f611831587507ff21e481a4afbbfc13a5441344
Author: David King <dking redhat com>
Date: Mon Oct 7 13:46:16 2013 +0100
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 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index de1ead8..eb2afd5 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -1341,7 +1341,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,
@@ -1406,7 +1410,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]