[glib-networking] tls/tests: don't try to assert !G_IS_OBJECT() on destroyed objects



commit fd06ab1cc79703ff83fef0d66fe4a4f385d1353e
Author: Dan Winship <danw gnome org>
Date:   Mon May 13 17:06:29 2013 -0400

    tls/tests: don't try to assert !G_IS_OBJECT() on destroyed objects
    
    The pkcs11 tests were using g_assert(!G_IS_OBJECT()) to verify that
    objects had been destroyed, but that's just crazy, and will crash
    sometimes. Fix them to do a ref_count check instead.

 tls/tests/pkcs11-pin.c  |    2 +-
 tls/tests/pkcs11-slot.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tls/tests/pkcs11-pin.c b/tls/tests/pkcs11-pin.c
index e08eff8..7888788 100644
--- a/tls/tests/pkcs11-pin.c
+++ b/tls/tests/pkcs11-pin.c
@@ -44,8 +44,8 @@ static void
 teardown_pin (TestPin       *test,
               gconstpointer  unused)
 {
+  g_assert_cmpint (G_OBJECT (test->pin)->ref_count, ==, 1);
   g_object_unref (test->pin);
-  g_assert (!G_IS_OBJECT (test->pin));
 }
 
 static void
diff --git a/tls/tests/pkcs11-slot.c b/tls/tests/pkcs11-slot.c
index fec9838..0d80044 100644
--- a/tls/tests/pkcs11-slot.c
+++ b/tls/tests/pkcs11-slot.c
@@ -72,11 +72,11 @@ teardown_slot (TestSlot     *test,
 {
   CK_RV rv;
 
+  g_assert_cmpint (G_OBJECT (test->slot)->ref_count, ==, 1);
   g_object_unref (test->slot);
-  g_assert (!G_IS_OBJECT (test->slot));
 
+  g_assert_cmpint (G_OBJECT (test->not_present)->ref_count, ==, 1);
   g_object_unref (test->not_present);
-  g_assert (!G_IS_OBJECT (test->not_present));
 
   rv = p11_kit_finalize_module (&test->funcs);
   g_assert (rv == CKR_OK);


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