From ed00f883e19daaf2fa1d7fabdb5deac298440177 Mon Sep 17 00:00:00 2001 From: jef Date: Tue, 25 Aug 2009 20:45:13 +0000 Subject: [PATCH] cleanup postgres column thread git-svn-id: http://svn.osgeo.org/qgis/trunk@11501 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/app/qgsdbsourceselect.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/qgsdbsourceselect.cpp b/src/app/qgsdbsourceselect.cpp index f4a9e019fac..8924309fa53 100644 --- a/src/app/qgsdbsourceselect.cpp +++ b/src/app/qgsdbsourceselect.cpp @@ -211,6 +211,14 @@ void QgsDbSourceSelect::setLayerType( QString schema, QgsDbSourceSelect::~QgsDbSourceSelect() { PQfinish( pd ); + + if ( mColumnTypeThread ) + { + mColumnTypeThread->stop(); + mColumnTypeThread->wait(); + delete mColumnTypeThread; + mColumnTypeThread = NULL; + } } void QgsDbSourceSelect::populateConnectionList() @@ -844,7 +852,7 @@ void QgsGeomColumnTypeThread::getLayerTypes() { PQsetClientEncoding( pd, QString( "UNICODE" ).toLocal8Bit() ); - for ( uint i = 0; i < schemas.size(); i++ ) + for ( uint i = 0; i < schemas.size() && !mStopped; i++ ) { QString query = QString( "select distinct " "case" @@ -871,12 +879,10 @@ void QgsGeomColumnTypeThread::getLayerTypes() } PQclear( gresult ); - if ( mStopped ) - break; - // Now tell the layer list dialog box... emit setLayerType( schemas[i], tables[i], columns[i], type ); } + } PQfinish( pd );