[tracker] libtracker-data: Fix concurrent async query operations



commit 65f17a05dc6a6ad6a6d2146f9b743092fd5ee34a
Author: Jürg Billeter <j bitron ch>
Date:   Mon Dec 13 10:18:13 2010 +0100

    libtracker-data: Fix concurrent async query operations
    
    Fixes NB#198155.

 src/libtracker-data/tracker-db-interface-sqlite.c |   23 +--------------------
 1 files changed, 1 insertions(+), 22 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index f4dfb4d..9e063d7 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -72,8 +72,6 @@ struct TrackerDBInterface {
 #endif
 	GCancellable *cancellable;
 
-	GAsyncReadyCallback outstanding_callback;
-
 	TrackerDBStatementLru select_stmt_lru;
 	TrackerDBStatementLru update_stmt_lru;
 
@@ -1360,23 +1358,6 @@ tracker_db_cursor_iter_next_thread (GSimpleAsyncResult *res,
 }
 
 static void
-async_ready_callback_wrapper (GObject      *source_object,
-                              GAsyncResult *res,
-                              gpointer      user_data)
-{
-	TrackerDBCursor *cursor = TRACKER_DB_CURSOR (source_object);
-	TrackerDBInterface *iface = cursor->ref_stmt->db_interface;
-
-	if (iface->outstanding_callback) {
-		GAsyncReadyCallback callback = iface->outstanding_callback;
-
-		iface->outstanding_callback = NULL;
-		(callback) (source_object, res, user_data);
-	}
-	g_object_unref (cursor);
-}
-
-static void
 tracker_db_cursor_iter_next_async (TrackerDBCursor     *cursor,
                                    GCancellable        *cancellable,
                                    GAsyncReadyCallback  callback,
@@ -1384,9 +1365,7 @@ tracker_db_cursor_iter_next_async (TrackerDBCursor     *cursor,
 {
 	GSimpleAsyncResult *res;
 
-	cursor->ref_stmt->db_interface->outstanding_callback = callback;
-
-	res = g_simple_async_result_new (g_object_ref (cursor), async_ready_callback_wrapper, user_data, tracker_db_cursor_iter_next_async);
+	res = g_simple_async_result_new (G_OBJECT (cursor), callback, user_data, tracker_db_cursor_iter_next_async);
 	g_simple_async_result_run_in_thread (res, tracker_db_cursor_iter_next_thread, 0, cancellable);
 }
 



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