Skip to content

Commit

Permalink
[mssql] Use currentThread instead of fragile currentThreadId to ID un…
Browse files Browse the repository at this point in the history
…ique connection names
  • Loading branch information
nyalldawson committed Oct 2, 2018
1 parent 7243224 commit b7333c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -1503,7 +1503,7 @@ QString QgsMssqlProvider::dbConnectionName( const QString &name )
// 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,
// 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;
}

Expand Down

0 comments on commit b7333c0

Please sign in to comment.