[gcr] gcr: Fix a couple of GSource leaks



commit 14c4c91b191a26c17fb5dfa4b8d68b94c2333dac
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Oct 27 13:24:37 2014 +0000

    gcr: Fix a couple of GSource leaks
    
    g_source_destroy() does not decrement the GSourceā€™s reference count.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739239

 gcr/gcr-system-prompt.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gcr/gcr-system-prompt.c b/gcr/gcr-system-prompt.c
index 5420ea0..d45efd8 100644
--- a/gcr/gcr-system-prompt.c
+++ b/gcr/gcr-system-prompt.c
@@ -151,10 +151,14 @@ static void
 call_closure_free (gpointer data)
 {
        CallClosure *closure = data;
-       if (closure->timeout)
+       if (closure->timeout) {
                g_source_destroy (closure->timeout);
-       if (closure->waiting)
+               g_source_unref (closure->timeout);
+       }
+       if (closure->waiting) {
                g_source_destroy (closure->waiting);
+               g_source_unref (closure->waiting);
+       }
        if (closure->watch_id)
                g_bus_unwatch_name (closure->watch_id);
        g_object_unref (closure->cancellable);
@@ -896,6 +900,7 @@ on_call_timeout (gpointer user_data)
        GcrSystemPrompt *self = GCR_SYSTEM_PROMPT (g_async_result_get_source_object (user_data));
 
        g_source_destroy (closure->timeout);
+       g_source_unref (closure->timeout);
        closure->timeout = NULL;
 
        /* Tell the prompter we're no longer interested */
@@ -919,6 +924,7 @@ on_call_cancelled (GCancellable *cancellable,
        GcrSystemPrompt *self = GCR_SYSTEM_PROMPT (g_async_result_get_source_object (user_data));
 
        g_source_destroy (call->waiting);
+       g_source_unref (call->waiting);
        call->waiting = NULL;
 
        g_simple_async_result_set_error (async, G_IO_ERROR, G_IO_ERROR_CANCELLED,


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