Skip to content
Permalink
Browse files

Merge pull request #5588 from nyalldawson/acquire

Workaround bug in Qt > 5.8 causing crashes in connection pools
  • Loading branch information
nyalldawson committed Nov 10, 2017
2 parents e1b76e0 + fef5618 commit abe5756d3e3b2e1fbc8551f7318b5fe3cdc9e7e7
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/core/qgsconnectionpool.h
@@ -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
{

0 comments on commit abe5756

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