[ostree] pull: Destroy queue watching GSource



commit 4c2a8bc2100f41bcb9ca275c6a414d1a3acb100e
Author: Colin Walters <walters verbum org>
Date:   Tue Jul 9 18:33:30 2013 -0400

    pull: Destroy queue watching GSource
    
    When being more of a library, we can't leave garbage attached to the
    default main context.

 src/ostree/ostree-pull.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index 061e68e..b816f6b 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -1202,6 +1202,7 @@ ostree_pull (OstreeRepo               *repo,
   gs_unref_hashtable GHashTable *commits_to_fetch = NULL;
   gs_free char *branch_rev = NULL;
   gs_free char *remote_mode_str = NULL;
+  GSource *queue_src = NULL;
   OtPullData pull_data_real;
   OtPullData *pull_data = &pull_data_real;
   SoupURI *summary_uri = NULL;
@@ -1399,10 +1400,10 @@ ostree_pull (OstreeRepo               *repo,
     }
   
   {
-    GSource *src = ot_waitable_queue_create_source (pull_data->metadata_objects_to_fetch);
-    g_source_set_callback (src, (GSourceFunc)on_metadata_objects_to_fetch_ready, pull_data, NULL);
-    g_source_attach (src, NULL);
-    g_source_unref (src);
+    queue_src = ot_waitable_queue_create_source (pull_data->metadata_objects_to_fetch);
+    g_source_set_callback (queue_src, (GSourceFunc)on_metadata_objects_to_fetch_ready, pull_data, NULL);
+    g_source_attach (queue_src, NULL);
+    g_source_unref (queue_src);
   }
 
   /* Prime the message queue */
@@ -1458,6 +1459,8 @@ ostree_pull (OstreeRepo               *repo,
   g_free (pull_data->remote_name);
   if (pull_data->base_uri)
     soup_uri_free (pull_data->base_uri);
+  if (queue_src)
+    g_source_destroy (queue_src);
   if (pull_data->metadata_thread)
     {
       ot_waitable_queue_push (pull_data->metadata_objects_to_scan,


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