From: APTX Date: Wed, 3 Apr 2013 16:58:16 +0000 (+0200) Subject: Unsubscribe before closing the connection. X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=414d6944f131d5a5d0e529c6e152df28c518dfb9;p=localmylist.git Unsubscribe before closing the connection. --- diff --git a/localmylist/database.cpp b/localmylist/database.cpp index ae3e707..c03f559 100644 --- a/localmylist/database.cpp +++ b/localmylist/database.cpp @@ -1325,6 +1325,10 @@ void Database::disconnect() d->preparedQueries.clear(); + auto subscribedNotifications = d->db.driver()->subscribedToNotifications(); + foreach (const QString ¬ification, subscribedNotifications) + d->db.driver()->unsubscribeFromNotification(notification); + if (!d->db.isOpen()) { qDebug() << "Not connected"; @@ -1333,10 +1337,6 @@ void Database::disconnect() d->db.close(); - auto subscribedNotifications = d->db.driver()->subscribedToNotifications(); - foreach (const QString ¬ification, subscribedNotifications) - d->db.driver()->unsubscribeFromNotification(notification); - emit disconnected(); }