[glib] test repeated g_hash_table_remove_all calls



commit eb7ffccf44ecb27f581693c4f62ed8d361999817
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 28 14:13:24 2015 -0400

    test repeated g_hash_table_remove_all calls
    
    I just came across a situation where code ended up stuck in
    an infinite loop in GHashTable code, so lets verify that this
    is a safe thing.

 glib/tests/hash.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/hash.c b/glib/tests/hash.c
index c1c8539..a3ccc89 100644
--- a/glib/tests/hash.c
+++ b/glib/tests/hash.c
@@ -823,6 +823,10 @@ test_remove_all (void)
   g_assert_cmpint (destroy_counter, ==, 2);
   g_assert_cmpint (destroy_key_counter, ==, 2);
 
+  g_hash_table_remove_all (h);
+  g_assert_cmpint (destroy_counter, ==, 2);
+  g_assert_cmpint (destroy_key_counter, ==, 2);
+
   g_hash_table_unref (h);
 }
 


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