Skip to content
Permalink
Browse files

fix #1371

git-svn-id: http://svn.osgeo.org/qgis/trunk@10580 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Apr 16, 2009
1 parent 93b2f42 commit 3b3556b06eccdbc4b11f9dcc3468f91220598331
Showing with 16 additions and 3 deletions.
  1. +16 −3 src/providers/grass/qgsgrassprovider.cpp
@@ -654,7 +654,20 @@ int QgsGrassProvider::openLayer( QString gisdbase, QString location, QString map
layer.nUsers = 1;

// Open map
layer.mapId = openMap( gisdbase, location, mapset, mapName );
QgsGrass::init();
QgsGrass::resetError();
if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
{
layer.mapId = openMap( gisdbase, location, mapset, mapName );
}
QgsGrass::clearErrorEnv();

if ( QgsGrass::getError() == QgsGrass::FATAL )
{
QgsDebugMsg( QString( "Cannot open vector map: %1" ).arg( QgsGrass::getErrorMessage() ) );
return -1;
}

if ( layer.mapId < 0 )
{
QgsDebugMsg( "Cannot open vector map" );
@@ -671,7 +684,7 @@ int QgsGrassProvider::openLayer( QString gisdbase, QString location, QString map
// Add new layer to layers
mLayers.push_back( layer );

QgsDebugMsg( QString( "New layer successfully opened%1" ).arg( layer.nAttributes ) );
QgsDebugMsg( QString( "New layer successfully opened: %1" ).arg( layer.nAttributes ) );

return mLayers.size() - 1;
}
@@ -946,7 +959,7 @@ void QgsGrassProvider::closeLayer( int layerId )
delete[] mLayers[layerId].minmax;

// Field info
free( mLayers[layerId].fieldInfo );
G_free( mLayers[layerId].fieldInfo );

closeMap( mLayers[layerId].mapId );
}

0 comments on commit 3b3556b

Please sign in to comment.