[tracker/direct-access: 34/158] libtracker-direct, libtracker-sparql: Make sure Connection is kept alife longer than Cursor



commit 2478ffa7a6ba10cc0d701b1760e3043e6c6adcd9
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Jul 8 13:54:10 2010 +0200

    libtracker-direct, libtracker-sparql: Make sure Connection is kept alife longer than Cursor

 src/libtracker-direct/tracker-connection.vala |    4 +++-
 src/libtracker-sparql/tracker-cursor.vala     |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-connection.vala b/src/libtracker-direct/tracker-connection.vala
index d68a424..444bb85 100644
--- a/src/libtracker-direct/tracker-connection.vala
+++ b/src/libtracker-direct/tracker-connection.vala
@@ -35,6 +35,8 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 
 	public override Sparql.Cursor query (string sparql) throws GLib.Error {
 		var query_object = new Sparql.Query (sparql);
-		return query_object.execute_cursor ();
+		var cursor = query_object.execute_cursor ();
+		cursor.connection = this;
+		return cursor;
 	}
 }
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index c30861a..b81cda3 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -18,6 +18,7 @@
  */
 
 public abstract class Tracker.Sparql.Cursor : Object {
+	public Connection connection { get; set; }
 	public abstract int n_columns { get; }
 	public abstract unowned string get_string (int column, out int length = null);
 	public virtual bool interrupt () throws GLib.Error {



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