summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-04-21 17:23:30 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-04-21 17:29:45 -0700
commitc9f1c84b30076d2750c73364870a9b5884a183bd (patch)
treecfe313e856e342e106483c38e8f7f9ed97b8e05b /app
parent3bf175c871cac7d6b60d8263196262ea5ffcda74 (diff)
lightmediascanner: correctly disconnect database connection
To avoid the following message, the SQL connection needs to be probably : QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed. Bug-AGL: SPEC-483 Change-Id: I8bc82503156c4b8f58ae8ecc9c186388106ddd00 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app')
-rw-r--r--app/lightmediascanner.cpp6
-rw-r--r--app/lightmediascanner.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/app/lightmediascanner.cpp b/app/lightmediascanner.cpp
index c17e0dc..7081f50 100644
--- a/app/lightmediascanner.cpp
+++ b/app/lightmediascanner.cpp
@@ -31,6 +31,12 @@ LightMediaScanner::LightMediaScanner(const QString& path)
}
}
+LightMediaScanner::~LightMediaScanner()
+{
+ lms.close();
+ QSqlDatabase::removeDatabase(lms.connectionName());
+}
+
bool LightMediaScanner::next(QString& item)
{
if (!query.next())
diff --git a/app/lightmediascanner.h b/app/lightmediascanner.h
index c1c688b..4323457 100644
--- a/app/lightmediascanner.h
+++ b/app/lightmediascanner.h
@@ -30,6 +30,7 @@
class LightMediaScanner {
public:
LightMediaScanner(const QString& path);
+ ~LightMediaScanner();
bool next(QString& item);
static QVariantList processLightMediaScanner();
private: