Skip to content
Permalink
Browse files

Fix #10127 (crash on parallel rendering of spatialite layers)

There was a run condition in connection pool singleton: at the beginning,
the singleton got initialized twice. Now the singleton is handled
as a static function variable which should be initialized in thread-safe way.
  • Loading branch information
wonder-sk committed Apr 28, 2014
1 parent 483ba9e commit dd739ef7363303e30981213d8eca99e7d65f9127
@@ -17,12 +17,9 @@

#include "qgspostgresconn.h"

QgsPostgresConnPool* QgsPostgresConnPool::mInstance = 0;


QgsPostgresConnPool* QgsPostgresConnPool::instance()
{
if ( !mInstance )
mInstance = new QgsPostgresConnPool;
return mInstance;
static QgsPostgresConnPool sInstance;
return &sInstance;
}
@@ -60,8 +60,6 @@ class QgsPostgresConnPool : public QgsConnectionPool<QgsPostgresConn*, QgsPostgr
public:
static QgsPostgresConnPool* instance();

protected:
static QgsPostgresConnPool* mInstance;
};


@@ -15,12 +15,9 @@

#include "qgsspatialiteconnpool.h"

QgsSpatiaLiteConnPool* QgsSpatiaLiteConnPool::mInstance = 0;


QgsSpatiaLiteConnPool* QgsSpatiaLiteConnPool::instance()
{
if ( !mInstance )
mInstance = new QgsSpatiaLiteConnPool;
return mInstance;
static QgsSpatiaLiteConnPool sInstance;
return &sInstance;
}
@@ -59,8 +59,6 @@ class QgsSpatiaLiteConnPool : public QgsConnectionPool<QgsSqliteHandle*, QgsSpat
public:
static QgsSpatiaLiteConnPool* instance();

protected:
static QgsSpatiaLiteConnPool* mInstance;
};


0 comments on commit dd739ef

Please sign in to comment.
You can’t perform that action at this time.