Skip to content
Permalink
Browse files

Tighten scope of connection

  • Loading branch information
nyalldawson committed Nov 1, 2018
1 parent a5ff6db commit c782f2782016f9be0f127de25a42e48e82ead378
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/core/auth/qgsauthmanager.cpp
  2. +1 −1 src/providers/mssql/qgsmssqlconnection.cpp
@@ -140,7 +140,7 @@ QSqlDatabase QgsAuthManager::authDatabaseConnection() const
// triggers a condition in QSqlDatabase which detects the nullptr private thread data and returns an invalid database instead.
// QSqlDatabase::removeDatabase is thread safe, so this is ok to do.
// Right about now is a good time to re-evaluate your selected career ;)
connect( QThread::currentThread(), &QThread::finished, this, [connectionName, this ]
connect( QThread::currentThread(), &QThread::finished, QThread::currentThread(), [connectionName, this ]
{
QMutexLocker locker( mMutex );
QgsDebugMsgLevel( QStringLiteral( "Removing outdated connection to %1 on thread exit" ).arg( connectionName ), 2 );
@@ -73,7 +73,7 @@ QSqlDatabase QgsMssqlConnection::getDatabase( const QString &service, const QStr
// and a subsequent call to QSqlDatabase::database with the same thread address (yep it happens, actually a lot)
// triggers a condition in QSqlDatabase which detects the nullptr private thread data and returns an invalid database instead.
// QSqlDatabase::removeDatabase is thread safe, so this is ok to do.
QObject::connect( QThread::currentThread(), &QThread::finished, QCoreApplication::instance(), [connectionName]
QObject::connect( QThread::currentThread(), &QThread::finished, QThread::currentThread(), [connectionName]
{
QMutexLocker locker( &sMutex );
QSqlDatabase::removeDatabase( connectionName );

0 comments on commit c782f27

Please sign in to comment.
You can’t perform that action at this time.