Skip to content
Permalink
Browse files

Destroy invalidated connection pool connections when released

  • Loading branch information
manisandro committed Feb 3, 2016
1 parent 50bbd6f commit eb3541e26a554d59100c2da1cc2c37751aab92dc
Showing with 15 additions and 8 deletions.
  1. +15 −8 src/core/qgsconnectionpool.h
@@ -128,15 +128,22 @@ class QgsConnectionPoolGroup
{
connMutex.lock();
acquiredConns.removeAll( conn );
Item i;
i.c = conn;
i.lastUsedTime = QTime::currentTime();
conns.push( i );

if ( !expirationTimer->isActive() )
if ( !qgsConnectionPool_ConnectionIsValid( conn ) )
{
qgsConnectionPool_ConnectionDestroy( conn );
}
else
{
// will call the slot directly or queue the call (if the object lives in a different thread)
QMetaObject::invokeMethod( expirationTimer->parent(), "startExpirationTimer" );
Item i;
i.c = conn;
i.lastUsedTime = QTime::currentTime();
conns.push( i );

if ( !expirationTimer->isActive() )
{
// will call the slot directly or queue the call (if the object lives in a different thread)
QMetaObject::invokeMethod( expirationTimer->parent(), "startExpirationTimer" );
}
}

connMutex.unlock();

0 comments on commit eb3541e

Please sign in to comment.
You can’t perform that action at this time.