Skip to content
Permalink
Browse files

Fix a crash on start due to race condition in GDAL data items

Thanks Radim for spotting this
  • Loading branch information
wonder-sk committed Jun 26, 2015
1 parent 7532000 commit a4b2cf88d01ccef1881e646e5cae14a4e06070f1
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/providers/gdal/qgsgdaldataitems.cpp
@@ -129,6 +129,7 @@ QString QgsGdalLayerItem::layerName() const
static QString filterString;
static QStringList extensions = QStringList();
static QStringList wildcards = QStringList();
static QMutex gBuildingFilters;

QGISEXTERN int dataCapabilities()
{
@@ -186,9 +187,15 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
// get supported extensions
if ( extensions.isEmpty() )
{
buildSupportedRasterFileFilterAndExtensions( filterString, extensions, wildcards );
QgsDebugMsgLevel( "extensions: " + extensions.join( " " ), 2 );
QgsDebugMsgLevel( "wildcards: " + wildcards.join( " " ), 2 );
// this code may be executed by more threads at once!
// use a mutex to make sure this does not happen (so there's no crash on start)
QMutexLocker locker( &gBuildingFilters );
if ( extensions.isEmpty() )
{
buildSupportedRasterFileFilterAndExtensions( filterString, extensions, wildcards );
QgsDebugMsgLevel( "extensions: " + extensions.join( " " ), 2 );
QgsDebugMsgLevel( "wildcards: " + wildcards.join( " " ), 2 );
}
}

// skip *.aux.xml files (GDAL auxilary metadata files),

0 comments on commit a4b2cf8

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