Skip to content

Commit f8247fa

Browse files
committed
Fix for segfault
1 parent bd77ecc commit f8247fa

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/providers/postgres/qgspostgresconn.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,11 @@ void QgsPostgresConn::disconnect()
270270
Q_ASSERT( !key.isNull() );
271271
connections.remove( key );
272272

273-
if ( QThread::currentThread() == QApplication::instance()->thread() )
274-
deleteLater();
273+
if ( !QApplication::instance() || QThread::currentThread() == QApplication::instance()->thread() )
274+
deleteLater();
275275
else
276-
delete this;
276+
delete this;
277+
277278
}
278279

279280
/* private */

0 commit comments

Comments
 (0)