[glib] tls-interaction test: use a weak pointer instead of a deliberate use-after-free



commit a1bd6e07172771f9a7e8006e5f1f824cc1f564ea
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Dec 13 18:18:27 2011 +0000

    tls-interaction test: use a weak pointer instead of a deliberate use-after-free
    
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
    Reviewed-by: Dan Winship <danw gnome org>

 gio/tests/tls-interaction.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/tls-interaction.c b/gio/tests/tls-interaction.c
index 486aca4..0c56814 100644
--- a/gio/tests/tls-interaction.c
+++ b/gio/tests/tls-interaction.c
@@ -384,10 +384,15 @@ static void
 teardown_without_loop (Test            *test,
                        gconstpointer    unused)
 {
+  gpointer weak_pointer = test->interaction;
+
+  g_object_add_weak_pointer (weak_pointer, &weak_pointer);
+
   g_object_unref (test->password);
 
   g_object_unref (test->interaction);
-  g_assert (!G_IS_OBJECT (test->interaction));
+
+  g_assert (weak_pointer == NULL);
 
 }
 



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