From c9f1c84b30076d2750c73364870a9b5884a183bd Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Fri, 21 Apr 2017 17:23:30 -0700 Subject: 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 --- app/lightmediascanner.cpp | 6 ++++++ app/lightmediascanner.h | 1 + 2 files changed, 7 insertions(+) (limited to 'app') 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: -- cgit 1.2.3-korg