Skip to content
Permalink
Browse files

[wfs] Fix race condition

Leads to multiple threads trying to create a cache db with the
same path, causing various crashes within the WFS iterator

(cherry-picked from 84d87a7)
  • Loading branch information
nyalldawson committed Jul 24, 2018
1 parent 7137a41 commit a1f8efa3c78f462da87227e8ab5864f77eef9a93
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/providers/wfs/qgswfsshareddata.cpp
@@ -213,9 +213,10 @@ bool QgsWFSSharedData::createCache()
{
Q_ASSERT( mCacheDbname.isEmpty() );

static int sTmpCounter = 0;
++sTmpCounter;
mCacheDbname = QDir( QgsWFSUtils::acquireCacheDirectory() ).filePath( QStringLiteral( "wfs_cache_%1.sqlite" ).arg( sTmpCounter ) );
static QAtomicInt sTmpCounter = 0;
int tmpCounter = ++sTmpCounter;
mCacheDbname = QDir( QgsWFSUtils::acquireCacheDirectory() ).filePath( QStringLiteral( "wfs_cache_%1.sqlite" ).arg( tmpCounter ) );
Q_ASSERT( !QFile::exists( mCacheDbname ) );

QgsFields cacheFields;
Q_FOREACH ( const QgsField &field, mFields )

0 comments on commit a1f8efa

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