Skip to content
Permalink
Browse files

force not shared postgres connection on non main thread

  • Loading branch information
blazek committed May 30, 2017
1 parent a468abb commit 0f2643174db9d75456c68653b9f8859d627bc933
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/providers/postgres/qgspostgresconn.cpp
@@ -146,6 +146,13 @@ QgsPostgresConn *QgsPostgresConn::connectDb( const QString &conninfo, bool reado
QMap<QString, QgsPostgresConn *> &connections =
readonly ? QgsPostgresConn::sConnectionsRO : QgsPostgresConn::sConnectionsRW;

// This is called from may places where shared parameter cannot be forced to false (QgsVectorLayerExporter)
// and which is run in a different thread (drag and drop in browser)
if ( QApplication::instance()->thread() != QThread::currentThread() )
{
shared = false;
}

if ( shared )
{
// sharing connection between threads is not safe

0 comments on commit 0f26431

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