mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
make initialization of connection pool thread save on MSVC
(probably better fix for 1e96813)
This commit is contained in:
parent
6a84e07cc2
commit
c550af2ee3
@ -15,10 +15,10 @@
|
||||
|
||||
#include "qgsogrconnpool.h"
|
||||
|
||||
QgsOgrConnPool QgsOgrConnPool::sInstance;
|
||||
|
||||
QgsOgrConnPool* QgsOgrConnPool::instance()
|
||||
{
|
||||
static QgsOgrConnPool sInstance;
|
||||
return &sInstance;
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,8 @@ class QgsOgrConnPool : public QgsConnectionPool<QgsOgrConn*, QgsOgrConnPoolGroup
|
||||
private:
|
||||
QgsOgrConnPool();
|
||||
~QgsOgrConnPool();
|
||||
|
||||
static QgsOgrConnPool sInstance;
|
||||
};
|
||||
|
||||
|
||||
|
@ -16,21 +16,11 @@
|
||||
#include "qgspostgresconnpool.h"
|
||||
#include "qgspostgresconn.h"
|
||||
|
||||
QgsPostgresConnPool QgsPostgresConnPool::sInstance;
|
||||
|
||||
QgsPostgresConnPool* QgsPostgresConnPool::instance()
|
||||
{
|
||||
static QgsPostgresConnPool *sInstance = 0;
|
||||
|
||||
if ( !sInstance )
|
||||
{
|
||||
static QMutex m;
|
||||
m.lock();
|
||||
if ( !sInstance )
|
||||
sInstance = new QgsPostgresConnPool();
|
||||
m.unlock();
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
return &sInstance;
|
||||
}
|
||||
|
||||
QgsPostgresConnPool::QgsPostgresConnPool() : QgsConnectionPool<QgsPostgresConn*, QgsPostgresConnPoolGroup>()
|
||||
|
@ -17,7 +17,6 @@
|
||||
#define QGSPOSTGRESCONNPOOL_H
|
||||
|
||||
#include "qgsconnectionpool.h"
|
||||
|
||||
#include "qgspostgresconn.h"
|
||||
|
||||
|
||||
@ -77,6 +76,8 @@ class QgsPostgresConnPool : public QgsConnectionPool<QgsPostgresConn*, QgsPostgr
|
||||
private:
|
||||
QgsPostgresConnPool();
|
||||
~QgsPostgresConnPool();
|
||||
|
||||
static QgsPostgresConnPool sInstance;
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
#include "qgsspatialiteconnpool.h"
|
||||
|
||||
QgsSpatiaLiteConnPool QgsSpatiaLiteConnPool::sInstance;
|
||||
|
||||
QgsSpatiaLiteConnPool* QgsSpatiaLiteConnPool::instance()
|
||||
{
|
||||
static QgsSpatiaLiteConnPool sInstance;
|
||||
return &sInstance;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#define QGSSPATIALITECONPOOL_H
|
||||
|
||||
#include "qgsconnectionpool.h"
|
||||
|
||||
#include "qgsspatialiteconnection.h"
|
||||
|
||||
inline QString qgsConnectionPool_ConnectionToName( QgsSqliteHandle* c )
|
||||
@ -67,9 +66,9 @@ class QgsSpatiaLiteConnPoolGroup : public QObject, public QgsConnectionPoolGroup
|
||||
/** SpatiaLite connection pool - singleton */
|
||||
class QgsSpatiaLiteConnPool : public QgsConnectionPool<QgsSqliteHandle*, QgsSpatiaLiteConnPoolGroup>
|
||||
{
|
||||
static QgsSpatiaLiteConnPool sInstance;
|
||||
public:
|
||||
static QgsSpatiaLiteConnPool* instance();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user