Skip to content

Commit 2afe449

Browse files
author
jef
committed
cleanup postgres column thread
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11501 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 42be35e commit 2afe449

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/app/qgsdbsourceselect.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ void QgsDbSourceSelect::setLayerType( QString schema,
211211
QgsDbSourceSelect::~QgsDbSourceSelect()
212212
{
213213
PQfinish( pd );
214+
215+
if ( mColumnTypeThread )
216+
{
217+
mColumnTypeThread->stop();
218+
mColumnTypeThread->wait();
219+
delete mColumnTypeThread;
220+
mColumnTypeThread = NULL;
221+
}
214222
}
215223

216224
void QgsDbSourceSelect::populateConnectionList()
@@ -844,7 +852,7 @@ void QgsGeomColumnTypeThread::getLayerTypes()
844852
{
845853
PQsetClientEncoding( pd, QString( "UNICODE" ).toLocal8Bit() );
846854

847-
for ( uint i = 0; i < schemas.size(); i++ )
855+
for ( uint i = 0; i < schemas.size() && !mStopped; i++ )
848856
{
849857
QString query = QString( "select distinct "
850858
"case"
@@ -871,12 +879,10 @@ void QgsGeomColumnTypeThread::getLayerTypes()
871879
}
872880
PQclear( gresult );
873881

874-
if ( mStopped )
875-
break;
876-
877882
// Now tell the layer list dialog box...
878883
emit setLayerType( schemas[i], tables[i], columns[i], type );
879884
}
885+
880886
}
881887

882888
PQfinish( pd );

0 commit comments

Comments
 (0)