Skip to content
Permalink
Browse files

Fix crash on exit: delete postgres connection pool before QApplication

  • Loading branch information
m-kuhn committed Apr 12, 2016
1 parent 601e430 commit 9a161ac449a202269b6655251bd38af8b45f3a0f
@@ -16,11 +16,19 @@
#include "qgspostgresconnpool.h"
#include "qgspostgresconn.h"

QgsPostgresConnPool QgsPostgresConnPool::sInstance;
QgsPostgresConnPool* QgsPostgresConnPool::sInstance = nullptr;

QgsPostgresConnPool* QgsPostgresConnPool::instance()
{
return &sInstance;
if ( !sInstance )
sInstance = new QgsPostgresConnPool();
return sInstance;
}

void QgsPostgresConnPool::cleanupInstance()
{
delete sInstance;
sInstance = nullptr;
}

QgsPostgresConnPool::QgsPostgresConnPool() : QgsConnectionPool<QgsPostgresConn*, QgsPostgresConnPoolGroup>()
@@ -70,14 +70,16 @@ class QgsPostgresConnPool : public QgsConnectionPool<QgsPostgresConn*, QgsPostgr
public:
static QgsPostgresConnPool* instance();

static void cleanupInstance();

protected:
Q_DISABLE_COPY( QgsPostgresConnPool )

private:
QgsPostgresConnPool();
~QgsPostgresConnPool();

static QgsPostgresConnPool sInstance;
static QgsPostgresConnPool* sInstance;
};


@@ -4130,6 +4130,10 @@ QGISEXTERN QgsTransaction* createTransaction( const QString& connString )
return new QgsPostgresTransaction( connString );
}

QGISEXTERN void cleanupProvider()
{
QgsPostgresConnPool::cleanupInstance();
}

// ----------

0 comments on commit 9a161ac

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