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



commit 6843f556be9b648951fc944986e333d48ed2e65e
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]