tls/tests: don't try to assert !G_IS_OBJECT() on destroyed objects
authorDan Winship <danw@gnome.org>
Mon, 13 May 2013 21:06:29 +0000 (17:06 -0400)
committerDan Winship <danw@gnome.org>
Mon, 20 May 2013 13:11:20 +0000 (10:11 -0300)
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
tls/tests/pkcs11-slot.c

index e08eff8..7888788 100644 (file)
@@ -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
index fec9838..0d80044 100644 (file)
@@ -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);