Delete QSparqlConnection when we are not active
authorMohammed Sameer <msameer@foolab.org>
Wed, 2 Jan 2013 00:44:58 +0000 (02:44 +0200)
committerMohammed Sameer <msameer@foolab.org>
Wed, 2 Jan 2013 00:44:58 +0000 (02:44 +0200)
src/trackerstore.cpp

index 604627d..dc27993 100644 (file)
@@ -58,7 +58,13 @@ void TrackerStore::setActive(bool active) {
     return;
   }
 
-  m_connection = new QSparqlConnection("QTRACKER_DIRECT", QSparqlConnectionOptions(), this);
+  if (active) {
+    m_connection = new QSparqlConnection("QTRACKER_DIRECT", QSparqlConnectionOptions(), this);
+  }
+  else {
+    m_connection->deleteLater();
+    m_connection = 0;
+  }
 
   emit activeChanged();
 }