Skip to content

Commit

Permalink
Destroy invalidated connection pool connections when released
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Feb 3, 2016
1 parent 50bbd6f commit eb3541e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/core/qgsconnectionpool.h
Expand Up @@ -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();
Expand Down

0 comments on commit eb3541e

Please sign in to comment.