Skip to content

Commit

Permalink
cleanup postgres column thread
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@11501 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 25, 2009
1 parent 20591ba commit ed00f88
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/app/qgsdbsourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"
Expand All @@ -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 );
Expand Down

0 comments on commit ed00f88

Please sign in to comment.