Fixed the use of a dangling reference
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 12 Oct 2008 02:10:45 +0000 (23:10 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 12 Oct 2008 04:27:24 +0000 (01:27 -0300)
When unreferencing the info object, the name attribute would be
released, resulting in a bug when trying to copy it right after that.
So, we unreference the info object in the end of the loop now.

backend/gio/gio.c

index 095345b..2f35a00 100644 (file)
@@ -99,7 +99,6 @@ gio_enumerate_entries (AtomCtx *ctx, char ***reqs, AtomEntry ***entries,
     {
       name = g_file_info_get_name (info);
       filename = g_build_filename (root, name, NULL);
-      g_object_unref (info);
       file = g_file_new_for_path (filename);
       entry = gio_file_to_atom (ctx, file);
       if (entry)
@@ -113,6 +112,7 @@ gio_enumerate_entries (AtomCtx *ctx, char ***reqs, AtomEntry ***entries,
         }
       g_object_unref (file);
       g_free (filename);
+      g_object_unref (info);
     }
   g_object_unref (enumerator);
   g_object_unref (dir);