[mssql] Use currentThread instead of fragile currentThreadId to ID unique connection names

This commit is contained in:
Nyall Dawson 2018-10-02 23:31:28 +10:00
parent 72432246a1
commit b7333c0664

View File

@ -1503,7 +1503,7 @@ QString QgsMssqlProvider::dbConnectionName( const QString &name )
// Starting with Qt 5.11, sharing the same connection between threads is not allowed. // Starting with Qt 5.11, sharing the same connection between threads is not allowed.
// We use a dedicated connection for each thread requiring access to the database, // We use a dedicated connection for each thread requiring access to the database,
// using the thread address as connection name. // using the thread address as connection name.
const QString threadAddress = QStringLiteral( ":0x%1" ).arg( reinterpret_cast< quintptr >( QThread::currentThreadId() ), 16 ); const QString threadAddress = QStringLiteral( ":0x%1" ).arg( QString::number( reinterpret_cast< quintptr >( QThread::currentThread() ), 16 ) );
return name + threadAddress; return name + threadAddress;
} }