[gvfs/gnome-2-26] Ref the infos in next_files_finish (#582195)



commit 28e55c86b931d696b182d0770d583905a9c0ce7f
Author: Alexander Larsson <alexl redhat com>
Date:   Tue May 12 14:21:45 2009 +0200

    Ref the infos in next_files_finish (#582195)
    
    In later glib versions setting the GSimpleAsyncResult gpointer data
    frees the old data using the destroy notify, which can cause crashes
    since we return it. So, just copy+ref the list instead of trying to steal
    the asyncresult one.
---
 client/gdaemonfileenumerator.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/client/gdaemonfileenumerator.c b/client/gdaemonfileenumerator.c
index 56b1488..1aec092 100644
--- a/client/gdaemonfileenumerator.c
+++ b/client/gdaemonfileenumerator.c
@@ -417,11 +417,8 @@ g_daemon_file_enumerator_next_files_finish (GFileEnumerator  *enumerator,
   GList *l;
 
   l = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
-  /* We want the caller to own this, and not the result, so clear the result data */
-  g_simple_async_result_set_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result),
-					     NULL, NULL);
-  
-  return l;
+  g_list_foreach (l, (GFunc)g_object_ref, NULL);
+  return g_list_copy (l);
 }
 
 static gboolean



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