diff options
author | Benjamin Otte <otte@redhat.com> | 2011-09-27 04:29:11 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-09-27 05:37:14 +0200 |
commit | 276a9d756769ea931a4c17fcca68b81b31dfd132 (patch) | |
tree | d4de146a11f49f22f951beab7ebde77e4044cbe7 /gtk/gtkcontainer.c | |
parent | 7724f14dfa7545cfb9f7a13cd0f2aa6a41018157 (diff) | |
download | gtk+-276a9d756769ea931a4c17fcca68b81b31dfd132.tar.gz |
container: Warn if an invalid widget path is created
This makes it quite a bit easier to debug things.
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r-- | gtk/gtkcontainer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index ac9bcf9726..6dd7a3c8ab 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -3377,9 +3377,21 @@ GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer *container, GtkWidget *child) { + GtkWidgetPath *path; + g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); g_return_val_if_fail (GTK_IS_WIDGET (child), NULL); g_return_val_if_fail (container == (GtkContainer *) gtk_widget_get_parent (child), NULL); - return GTK_CONTAINER_GET_CLASS (container)->get_path_for_child (container, child); + path = GTK_CONTAINER_GET_CLASS (container)->get_path_for_child (container, child); + if (gtk_widget_path_get_object_type (path) != G_OBJECT_TYPE (child)) + { + g_critical ("%s %p returned a widget path for type %s, but child is %s", + G_OBJECT_TYPE_NAME (container), + container, + g_type_name (gtk_widget_path_get_object_type (path)), + G_OBJECT_TYPE_NAME (child)); + } + + return path; } |