[glib] tests: check for NULL before g_object_unref()



commit c7f0ea435471024fc2531ac5185d9f4b5127bfb0
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Feb 4 17:47:39 2015 +0100

    tests: check for NULL before g_object_unref()
    
    delayed_close_free() calls g_object_unref() on a variable that is
    expected to possibly contain NULL (as indicated by the fact that the
    NULL case is handled in my_slow_close_output_stream_close_async()).
    
    This is dead code right now (due to a bug in GDBus), which is why it
    isn't actually causing a failure.  It should still be fixed, however.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743990

 gio/tests/gdbus-close-pending.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/gdbus-close-pending.c b/gio/tests/gdbus-close-pending.c
index c74ce66..762d931 100644
--- a/gio/tests/gdbus-close-pending.c
+++ b/gio/tests/gdbus-close-pending.c
@@ -174,7 +174,8 @@ delayed_close_free (gpointer data)
   DelayedClose *df = data;
 
   g_object_unref (df->stream);
-  g_object_unref (df->cancellable);
+  if (df->cancellable)
+    g_object_unref (df->cancellable);
   g_free (df);
 }
 


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