Skip to content

Commit

Permalink
Merge pull request #5588 from nyalldawson/acquire
Browse files Browse the repository at this point in the history
Workaround bug in Qt > 5.8 causing crashes in connection pools
  • Loading branch information
nyalldawson committed Nov 10, 2017
2 parents e1b76e0 + fef5618 commit abe5756
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/core/qgsconnectionpool.h
Expand Up @@ -95,8 +95,19 @@ class QgsConnectionPoolGroup
T acquire( int timeout )
{
// we are going to acquire a resource - if no resource is available, we will block here
if ( !sem.tryAcquire( 1, timeout ) )
return nullptr;
if ( timeout >= 0 )
{
if ( !sem.tryAcquire( 1, timeout ) )
return nullptr;
}
else
{
// we should still be able to use tryAcquire with a negative timeout here, but
// tryAcquire is broken on Qt > 5.8 with negative timeouts - see
// https://bugreports.qt.io/browse/QTBUG-64413
// https://lists.osgeo.org/pipermail/qgis-developer/2017-November/050456.html
sem.acquire( 1 );
}

// quick (preferred) way - use cached connection
{
Expand Down

0 comments on commit abe5756

Please sign in to comment.