[tracker/bug645963] libtracker-direct: Use thread-default main context for async callback



commit 3edd97ada45fe962b113e55db48035d7a7843798
Author: Jürg Billeter <j bitron ch>
Date:   Mon Mar 28 17:55:46 2011 +0200

    libtracker-direct: Use thread-default main context for async callback
    
    This fixes the main context used for invoking the async ready callback
    of tracker_direct_connection_query_async.
    
    Fixes GB#645963.

 src/libtracker-direct/tracker-direct.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index d19a3f9..9abf5b7 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -79,6 +79,7 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 			IOError io_error = null;
 			DBusError dbus_error = null;
 			Sparql.Cursor result = null;
+			var context = MainContext.get_thread_default ();
 
 			g_io_scheduler_push_job (job => {
 				try {
@@ -90,7 +91,14 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 				} catch (DBusError e_dbus) {
 					dbus_error = e_dbus;
 				}
-				query_async.callback ();
+
+				var source = new IdleSource ();
+				source.set_callback (() => {
+					query_async.callback ();
+					return false;
+				});
+				source.attach (context);
+
 				return false;
 			});
 			yield;



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