Skip to content

Commit

Permalink
fix #1371
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10580 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 16, 2009
1 parent dfc39e6 commit 37c73c1
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/providers/grass/qgsgrassprovider.cpp
Expand Up @@ -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" );
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 );
}
Expand Down

0 comments on commit 37c73c1

Please sign in to comment.