1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

SqlDatabase: Remove existing database before adding new

Fixes duplicate connection warning.
This commit is contained in:
David Rosca 2019-01-26 14:03:39 +01:00
parent b9c4a92aef
commit 4990eed417
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -120,8 +120,9 @@ QSqlDatabase SqlDatabase::database()
}
if (!s_databases.hasLocalData()) {
const QString threadStr = QString::number((quintptr) QThread::currentThread());
QSqlDatabase db = QSqlDatabase::addDatabase(QSL("QSQLITE"), QSL("Falkon/") + threadStr);
const QString threadStr = QStringLiteral("Falkon/%1").arg((quintptr) QThread::currentThread());
QSqlDatabase::removeDatabase(threadStr);
QSqlDatabase db = QSqlDatabase::addDatabase(QSL("QSQLITE"), threadStr);
db.setDatabaseName(m_databaseName);
db.setConnectOptions(m_connectOptions);
db.open();