[tracker/direct-access: 29/40] libtracker-direct: Fix warning on clean-up after failed initialization



commit fc6c4e35c90887cf995bd334e200839e510cd1e3
Author: Jürg Billeter <j bitron ch>
Date:   Thu Jul 22 11:06:27 2010 +0200

    libtracker-direct: Fix warning on clean-up after failed initialization

 src/libtracker-direct/tracker-direct.vala |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index d1cd63e..1141af3 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -23,16 +23,18 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 
 	public Connection () throws Sparql.Error
 	requires (!initialized) {
-		initialized = true;
 		if (!Data.Manager.init (DBManagerFlags.READONLY, null, null, false, null, null)) {
 			throw new Sparql.Error.INTERNAL ("Unable to initialize database");
 		}
+		initialized = true;
 	}
 
 	~Connection () {
 		// Clean up connection
-		Data.Manager.shutdown ();
-		initialized = false;
+		if (initialized) {
+			Data.Manager.shutdown ();
+			initialized = false;
+		}
 	}
 
 	public override Sparql.Cursor? query (string sparql, Cancellable? cancellable) throws Sparql.Error {



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