Safely close database connections and delete backends

Also fix NewClosure leak caused by disconnected object signals
This commit is contained in:
Jonas Kvinge
2019-07-24 19:16:51 +02:00
parent bd78e8c275
commit b5eb13449b
47 changed files with 490 additions and 53 deletions

View File

@@ -68,6 +68,7 @@ class Database : public QObject {
static const char *kMagicAllSongsTables;
QSqlDatabase Connect();
void Close();
bool CheckErrors(const QSqlQuery &query);
QMutex *Mutex() { return &mutex_; }
@@ -111,6 +112,7 @@ signals:
// This ID makes the QSqlDatabase name unique to the object as well as the thread
int connection_id_;
QStringList connections_;
static QMutex sNextConnectionIdMutex;
static int sNextConnectionId;