Skip to content

Instantly share code, notes, and snippets.

@jef-n
Created January 7, 2014 10:01
Show Gist options
  • Save jef-n/8297212 to your computer and use it in GitHub Desktop.
Save jef-n/8297212 to your computer and use it in GitHub Desktop.
diff --git a/src/providers/postgres/qgspostgresconn.cpp b/src/providers/postgres/qgspostgresconn.cpp
index 7290137..cdf7e20 100644
--- a/src/providers/postgres/qgspostgresconn.cpp
+++ b/src/providers/postgres/qgspostgresconn.cpp
@@ -270,7 +270,7 @@ void QgsPostgresConn::disconnect()
Q_ASSERT( !key.isNull() );
connections.remove( key );
- if ( QThread::currentThread() == QApplication::instance()->thread() )
+ if ( !QApplication::instance() || QThread::currentThread() == QApplication::instance()->thread() )
deleteLater();
else
delete this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment