Skip to content

Commit

Permalink
Explicitly close gdal dataset handles as early as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 25, 2017
1 parent 052688c commit 8eb919e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/providers/gdal/qgsgdaldataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
}

QStringList sublayers = QgsGdalProvider::subLayers( hDS.get() );
hDS.reset();

QgsDebugMsgLevel( "GdalDataset opened " + path, 2 );

Expand Down
1 change: 1 addition & 0 deletions src/providers/ogr/qgsogrdataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ QList<QgsOgrDbLayerInfo *> QgsOgrLayerItem::subLayers( const QString &path, cons
{
QString uri( QStringLiteral( "%1:%2" ).arg( driver, path ) );
QString name = GDALGetMetadataItem( hDS.get(), "IDENTIFIER", NULL );
hDS.reset();
// Fallback: will not be able to delete the table
if ( name.isEmpty() )
{
Expand Down

0 comments on commit 8eb919e

Please sign in to comment.