[bijiben] noteBook: close enumarator as soon as files listed



commit 28865af8246b64fe608717ce53dced3af7ff64e6
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Wed Dec 12 23:36:54 2012 +0100

    noteBook: close enumarator as soon as files listed
    
    And free it as soon as closed.

 src/libbiji/biji-note-book.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/libbiji/biji-note-book.c b/src/libbiji/biji-note-book.c
index 7469734..345cb2a 100644
--- a/src/libbiji/biji-note-book.c
+++ b/src/libbiji/biji-note-book.c
@@ -207,6 +207,15 @@ load_location_error (GFile *location,
 }
 
 static void
+release_enum_cb (GObject *source, GAsyncResult *res, gpointer user_data)
+{
+  g_file_enumerator_close_finish (G_FILE_ENUMERATOR (source),
+                                  res,
+                                  NULL);
+  g_object_unref (source);
+}
+
+static void
 enumerate_next_files_ready_cb (GObject *source,
                                GAsyncResult *res,
                                gpointer user_data)
@@ -218,6 +227,8 @@ enumerate_next_files_ready_cb (GObject *source,
   gchar *base_path;
 
   files = g_file_enumerator_next_files_finish (enumerator, res, &error);
+  g_file_enumerator_close_async (enumerator, G_PRIORITY_DEFAULT, NULL,
+                                 release_enum_cb, NULL);
 
   if (error != NULL)
     {



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