[glib-controller] examples: Verify that we don't iterate over an empty model
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-controller] examples: Verify that we don't iterate over an empty model
- Date: Wed, 7 Mar 2012 16:33:49 +0000 (UTC)
commit 2031640035ff41eda0d8bee41bbfa87d3bdfacf5
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Mar 7 16:33:23 2012 +0000
examples: Verify that we don't iterate over an empty model
examples/simple-model.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/examples/simple-model.c b/examples/simple-model.c
index d2f2825..004733c 100644
--- a/examples/simple-model.c
+++ b/examples/simple-model.c
@@ -336,6 +336,7 @@ main (int argc, char *argv[])
g_print ("\trow[%d] = '%s'\n", i, my_simple_model_get_text (model, i));
i += 1;
}
+ g_iterator_unref (iter);
my_simple_model_remove_text (model, "baz");
@@ -347,9 +348,16 @@ main (int argc, char *argv[])
g_print ("\trow[%d] = '%s'\n", i, my_simple_model_get_text (model, i));
i += 1;
}
+ g_iterator_unref (iter);
my_simple_model_clear (model);
+ g_print ("Model contents:\n");
+ iter = g_iterable_create_iterator (G_ITERABLE (model));
+ while (g_iterator_next (iter))
+ g_assert_not_reached ();
+ g_iterator_unref (iter);
+
g_object_unref (model);
return EXIT_SUCCESS;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]