Skip to content
Permalink
Browse files

Recursive mutex fixes

  • Loading branch information
nyalldawson committed Apr 1, 2021
1 parent 615b63e commit 6eed7a4d3d4be9b44a7fdc88dcf9aa2c4a475f72
@@ -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
@@ -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 )
@@ -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;
@@ -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 )
{
@@ -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
@@ -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 );
@@ -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

0 comments on commit 6eed7a4

Please sign in to comment.