1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-02-02 02:26:44 +01:00

CollectionModel: Close database with same mutex

This commit is contained in:
Jonas Kvinge 2023-01-07 23:57:23 +01:00
parent 1c1a3fc417
commit cc4a99ad80

View File

@ -839,8 +839,8 @@ CollectionModel::QueryResult CollectionModel::RunQuery(CollectionItem *parent) {
{ {
QMutexLocker l(backend_->db()->Mutex()); QMutexLocker l(backend_->db()->Mutex());
{
QSqlDatabase db(backend_->db()->Connect()); QSqlDatabase db(backend_->db()->Connect());
CollectionQuery q(db, backend_->songs_table(), backend_->fts_table(), query_options_); CollectionQuery q(db, backend_->songs_table(), backend_->fts_table(), query_options_);
InitQuery(child_group_by, separate_albums_by_grouping_, &q); InitQuery(child_group_by, separate_albums_by_grouping_, &q);
@ -873,7 +873,9 @@ CollectionModel::QueryResult CollectionModel::RunQuery(CollectionItem *parent) {
} }
if (QThread::currentThread() != thread() && QThread::currentThread() != backend_->thread()) { if (QThread::currentThread() != thread() && QThread::currentThread() != backend_->thread()) {
backend_->Close(); backend_->db()->Close();
}
} }
return result; return result;