[gtk+] GtkListBox: Add g_return_if_fail checks to public row functions



commit 5d121a8aaaa062711a4b46ca5579c80162c5ded8
Author: Kalev Lember <kalevlember gmail com>
Date:   Thu Jul 4 15:50:09 2013 +0200

    GtkListBox: Add g_return_if_fail checks to public row functions

 gtk/gtklistbox.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index d191a45..4842108 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -2623,6 +2623,8 @@ gtk_list_box_row_changed (GtkListBoxRow *row)
 {
   GtkListBox *list_box = gtk_list_box_row_get_box (row);
 
+  g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
+
   if (list_box)
     gtk_list_box_got_row_changed (GTK_LIST_BOX (list_box), row);
 }
@@ -2644,6 +2646,8 @@ gtk_list_box_row_get_header (GtkListBoxRow *row)
 {
   GtkListBoxRowPrivate *priv = gtk_list_box_row_get_instance_private (row);
 
+  g_return_val_if_fail (GTK_IS_LIST_BOX_ROW (row), NULL);
+
   return priv->header;
 }
 
@@ -2664,6 +2668,9 @@ gtk_list_box_row_set_header (GtkListBoxRow *row,
 {
   GtkListBoxRowPrivate *priv = gtk_list_box_row_get_instance_private (row);
 
+  g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
+  g_return_if_fail (header == NULL || GTK_IS_WIDGET (header));
+
   if (priv->header)
     g_object_unref (priv->header);
 
@@ -2688,6 +2695,8 @@ gtk_list_box_row_get_index (GtkListBoxRow *row)
 {
   GtkListBoxRowPrivate *priv = gtk_list_box_row_get_instance_private (row);
 
+  g_return_val_if_fail (GTK_IS_LIST_BOX_ROW (row), -1);
+
   if (priv->iter != NULL)
     return g_sequence_iter_get_position (priv->iter);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]