Skip to content

Commit

Permalink
Recursive mutex fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 1, 2021
1 parent 615b63e commit 6eed7a4
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/auth/oauth2/qgsauthoauth2method.h
Expand Up @@ -114,7 +114,11 @@ class QgsAuthOAuth2Method : public QgsAuthMethod

QgsO2 *authO2( const QString &authcfg );

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QMutex mNetworkRequestMutex { QMutex::Recursive };
#else
QRecursiveMutex mNetworkRequestMutex;
#endif
};

#endif // QGSAUTHOAUTH2METHOD_H
6 changes: 5 additions & 1 deletion src/providers/db2/qgsdb2provider.cpp
Expand Up @@ -34,7 +34,11 @@ const QString QgsDb2Provider::DB2_PROVIDER_KEY = QStringLiteral( "DB2" );
const QString QgsDb2Provider::DB2_PROVIDER_DESCRIPTION = QStringLiteral( "DB2 Spatial Extender provider" );

int QgsDb2Provider::sConnectionId = 0;
QMutex QgsDb2Provider::sMutex{ QMutex::Recursive };
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QMutex QgsDb2Provider::sMutex { QMutex::Recursive };
#else
QRecursiveMutex QgsDb2Provider::sMutex;
#endif

QgsDb2Provider::QgsDb2Provider( const QString &uri, const ProviderOptions &options,
QgsDataProvider::ReadFlags flags )
Expand Down
4 changes: 4 additions & 0 deletions src/providers/db2/qgsdb2provider.h
Expand Up @@ -132,7 +132,11 @@ class QgsDb2Provider final: public QgsVectorDataProvider
*/
static QString dbConnectionName( const QString &name );

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
static QMutex sMutex;
#else
static QRecursiveMutex sMutex;
#endif

QgsFields mAttributeFields; //fields
QMap<int, QVariant> mDefaultValues;
Expand Down
6 changes: 5 additions & 1 deletion src/providers/mssql/qgsmssqlconnection.cpp
Expand Up @@ -29,7 +29,11 @@
#include <QFile>

int QgsMssqlConnection::sConnectionId = 0;
QMutex QgsMssqlConnection::sMutex{ QMutex::Recursive };
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QMutex QgsMssqlConnection::sMutex { QMutex::Recursive };
#else
QRecursiveMutex QgsMssqlConnection::sMutex;
#endif

QSqlDatabase QgsMssqlConnection::getDatabase( const QString &service, const QString &host, const QString &database, const QString &username, const QString &password )
{
Expand Down
4 changes: 4 additions & 0 deletions src/providers/mssql/qgsmssqlconnection.h
Expand Up @@ -272,7 +272,11 @@ class QgsMssqlConnection

static int sConnectionId;

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
static QMutex sMutex;
#else
static QRecursiveMutex sMutex;
#endif
};

#endif // QGSMSSQLCONNECTION_H
1 change: 0 additions & 1 deletion src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -229,7 +229,6 @@ QgsPostgresConn::QgsPostgresConn( const QString &conninfo, bool readOnly, bool s
, mNextCursorId( 0 )
, mShared( shared )
, mTransaction( transaction )
, mLock( QMutex::Recursive )
{

QgsDebugMsgLevel( QStringLiteral( "New PostgreSQL connection for " ) + conninfo, 2 );
Expand Down
6 changes: 5 additions & 1 deletion src/providers/postgres/qgspostgresconn.h
Expand Up @@ -476,7 +476,11 @@ class QgsPostgresConn : public QObject

bool mTransaction;

mutable QMutex mLock;
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
mutable QMutex mLock { QMutex::Recursive };
#else
mutable QRecursiveMutex mLock;
#endif
};

// clazy:excludeall=qstring-allocations
Expand Down

0 comments on commit 6eed7a4

Please sign in to comment.