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

@@ -49,6 +49,7 @@ class SCollection : public QObject {
static const char *kFtsTable;
void Init();
void Exit();
CollectionBackend *backend() const { return backend_; }
CollectionModel *model() const { return model_; }
@@ -70,12 +71,17 @@ class SCollection : public QObject {
void Rescan(const SongList &songs);
private slots:
void ExitReceived();
void IncrementalScan();
void CurrentSongChanged(const Song &song);
void SongsStatisticsChanged(const SongList& songs);
void Stopped();
signals:
void ExitFinished();
private:
Application *app_;
CollectionBackend *backend_;
@@ -83,9 +89,12 @@ class SCollection : public QObject {
CollectionWatcher *watcher_;
Thread *watcher_thread_;
QThread *original_thread_;
// DB schema versions which should trigger a full collection rescan (each of those with a short reason why).
QHash<int, QString> full_rescan_revisions_;
QList<QObject*> wait_for_exit_;
};
#endif