[QGIS Commit] r11434 - in trunk/qgis/src: plugins/grass providers/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 19 08:59:40 EDT 2009


Author: pcav
Date: 2009-08-19 08:59:39 -0400 (Wed, 19 Aug 2009)
New Revision: 11434

Modified:
   trunk/qgis/src/plugins/grass/qgsgrassmodel.cpp
   trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
   trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
   trunk/qgis/src/plugins/grass/qgsgrassselect.cpp
   trunk/qgis/src/providers/grass/qgsgrass.cpp
   trunk/qgis/src/providers/grass/qgsgrass.h
   trunk/qgis/src/providers/grass/qgsgrassprovider.cpp
Log:
Revert patch uncorrectly applied

Modified: trunk/qgis/src/plugins/grass/qgsgrassmodel.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodel.cpp	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodel.cpp	2009-08-19 12:59:39 UTC (rev 11434)
@@ -37,7 +37,7 @@
 {
   public:
     QgsGrassModelItem( QgsGrassModelItem *parent, int row, QString name,
-    QString path, int type );
+                       QString path, int type );
     QgsGrassModelItem();
     ~QgsGrassModelItem();
 
@@ -81,7 +81,7 @@
 
 QgsGrassModelItem::~QgsGrassModelItem()
 {
-  for ( int i = 0; i < mChildren.size(); i++ )
+  for ( int i = 0; i < mChildren.size();i++ )
   {
     delete mChildren[i];
   }
@@ -606,13 +606,13 @@
 
   // Add new items
 
-  for ( int i = 0; i < list.size(); i++ )
+  for ( int i = 0; i < list.size();i++ )
   {
     QString name = list.at( i );
 // QgsDebugMsg(QString("? add %1").arg(name));
 
     int insertAt = item->mChildren.size();
-    for ( int i = 0; i < item->mChildren.size(); i++ )
+    for ( int i = 0; i < item->mChildren.size();i++ )
     {
       if ( item->mChildren[i]->name() == name )
       {
@@ -897,6 +897,7 @@
       default:
         return mIconDirectory;
     }
+    return mIconDirectory;
   }
   return item->data( role );
 }

Modified: trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp	2009-08-19 12:59:39 UTC (rev 11434)
@@ -1268,20 +1268,17 @@
 
     int ret = 0;
 
-    try
+    QgsGrass::resetError();
+    if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
     {
       ret = G_make_location( location.toAscii().data(), &mCellHead, mProjInfo, mProjUnits, stdout );
     }
-    catch ( QgsGrass::Exception &e )
-    {
-      ret = -1;
-      Q_UNUSED( e );
-    }
+    QgsGrass::clearErrorEnv();
 
-    if ( ret != 0 )
+    if ( QgsGrass::getError() == QgsGrass::FATAL || ret != 0 )
     {
       QMessageBox::warning( this, tr( "Create location" ),
-                            tr( "Cannot create new location: %1" ).arg( QgsGrass::errorMessage() ) );
+                            tr( "Cannot create new location: %1" ).arg( QgsGrass::getErrorMessage() ) );
       return;
     }
 

Modified: trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2009-08-19 12:59:39 UTC (rev 11434)
@@ -301,13 +301,14 @@
     QgsGrass::setLocation( sel->gisdbase, sel->location );
 
     /* Open vector */
-    try
-    {
-      Vect_set_open_level( 2 );
-      struct Map_info map;
-      int level = Vect_open_old_head( &map, sel->map.toAscii().data(),
-                                      sel->mapset.toAscii().data() );
+    QgsGrass::resetError();
+    Vect_set_open_level( 2 );
+    struct Map_info map;
+    int level = Vect_open_old_head( &map, sel->map.toAscii().data(),
+                                    sel->mapset.toAscii().data() );
 
+    if ( QgsGrass::getError() != QgsGrass::FATAL )
+    {
       if ( level >= 2 )
       {
         // Count layers
@@ -335,9 +336,9 @@
 
       Vect_close( &map );
     }
-    catch ( QgsGrass::Exception &e )
+    else
     {
-      QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( e.what() ) );
+      QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( QgsGrass::getErrorMessage() ) );
     }
 
     qGisInterface->addVectorLayer( uri, name, "grass" );
@@ -485,29 +486,26 @@
                        QgsGrass::getDefaultLocation(),
                        QgsGrass::getDefaultMapset() );
 
-  try
+  QgsGrass::resetError();
+  struct Map_info Map;
+  Vect_open_new( &Map, name.toAscii().data(), 0 );
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    struct Map_info Map;
-    Vect_open_new( &Map, name.toAscii().data(), 0 );
+    QMessageBox::warning( 0, tr( "Warning" ),
+                          tr( "Cannot create new vector: %1" ).arg( QgsGrass::getErrorMessage() ) );
+    return;
+  }
 
 #if defined(GRASS_VERSION_MAJOR) && defined(GRASS_VERSION_MINOR) && \
   ( ( GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR >= 4 ) || GRASS_VERSION_MAJOR > 6 )
-    Vect_build( &Map );
+  Vect_build( &Map );
 #else
-    Vect_build( &Map, stderr );
+  Vect_build( &Map, stderr );
 #endif
-    Vect_set_release_support( &Map );
-    Vect_close( &Map );
-  }
-  catch ( QgsGrass::Exception &e )
-  {
-    QMessageBox::warning( 0, tr( "Warning" ),
-                          tr( "Cannot create new vector: %1" ).arg( e.what() ) );
-    return;
-  }
+  Vect_set_release_support( &Map );
+  Vect_close( &Map );
 
-
-
   // Open in GRASS vector provider
 
   QString uri = QgsGrass::getDefaultGisdbase() + "/"

Modified: trunk/qgis/src/plugins/grass/qgsgrassselect.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassselect.cpp	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/plugins/grass/qgsgrassselect.cpp	2009-08-19 12:59:39 UTC (rev 11434)
@@ -410,14 +410,15 @@
   // Call to setjmp() returns 0 first time. In case of fatal error,
   // our error routine uses longjmp() to come back to this context,
   // this time setjmp() will return non-zero value and we can continue...
-
-  try
+  if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
   {
     level = Vect_open_old_head( &map, ( char * ) mapName.toAscii().data(), ( char * ) mapset.toAscii().data() );
   }
-  catch ( QgsGrass::Exception &e )
+  QgsGrass::clearErrorEnv();
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    QgsDebugMsg( QString( "Cannot open GRASS vector: %1" ).arg( e.what() ) );
+    QgsDebugMsg( QString( "Cannot open GRASS vector: %1" ).arg( QgsGrass::getErrorMessage() ) );
     return list;
   }
 

Modified: trunk/qgis/src/providers/grass/qgsgrass.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrass.cpp	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/providers/grass/qgsgrass.cpp	2009-08-19 12:59:39 UTC (rev 11434)
@@ -54,8 +54,7 @@
   // Set error function
   G_set_error_routine( &error_routine );
 
-  if ( initialized )
-    return;
+  if ( initialized ) return;
 
   QSettings settings;
 
@@ -356,7 +355,7 @@
 
 bool QgsGrass::active = 0;
 
-QgsGrass::GERROR QgsGrass::lastError = QgsGrass::OK;
+QgsGrass::GERROR QgsGrass::error = QgsGrass::OK;
 
 QString QgsGrass::error_message;
 
@@ -368,6 +367,9 @@
 QString QgsGrass::mGisrc;
 QString QgsGrass::mTmp;
 
+jmp_buf QgsGrass::mFatalErrorEnv;
+bool QgsGrass::mFatalErrorEnvActive = false;
+
 int QgsGrass::error_routine( char *msg, int fatal )
 {
   return error_routine(( const char* ) msg, fatal );
@@ -381,30 +383,52 @@
 
   if ( fatal )
   {
+    error = FATAL;
     // we have to do a long jump here, otherwise GRASS >= 6.3 will kill our process
-    throw QgsGrass::Exception( msg );
+    if ( mFatalErrorEnvActive )
+      longjmp( mFatalErrorEnv, 1 );
+    else
+    {
+      QMessageBox::warning( 0, QObject::tr( "Uncatched fatal GRASS error" ), msg );
+      abort();
+    }
   }
   else
-    lastError = WARNING;
+    error = WARNING;
 
   return 1;
 }
 
 void GRASS_EXPORT QgsGrass::resetError( void )
 {
-  lastError = OK;
+  error = OK;
 }
 
-int GRASS_EXPORT QgsGrass::error( void )
+int GRASS_EXPORT QgsGrass::getError( void )
 {
-  return lastError;
+  return error;
 }
 
-QString GRASS_EXPORT QgsGrass::errorMessage( void )
+QString GRASS_EXPORT QgsGrass::getErrorMessage( void )
 {
   return error_message;
 }
 
+jmp_buf GRASS_EXPORT &QgsGrass::fatalErrorEnv()
+{
+  if ( mFatalErrorEnvActive )
+    QgsDebugMsg( "fatal error environment already active." );
+  mFatalErrorEnvActive = true;
+  return mFatalErrorEnv;
+}
+
+void GRASS_EXPORT QgsGrass::clearErrorEnv()
+{
+  if ( !mFatalErrorEnvActive )
+    QgsDebugMsg( "fatal error environment already deactive." );
+  mFatalErrorEnvActive = false;
+}
+
 QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, QString mapset )
 {
   QgsDebugMsg( QString( "gisdbase = %1" ).arg( gisdbase.toLocal8Bit().constData() ) );

Modified: trunk/qgis/src/providers/grass/qgsgrass.h
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrass.h	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/providers/grass/qgsgrass.h	2009-08-19 12:59:39 UTC (rev 11434)
@@ -24,21 +24,15 @@
 }
 
 #include <QString>
+#include <setjmp.h>
 
 /*!
    Methods for C library initialization and error handling.
 */
 class QgsGrass
 {
+
   public:
-    class Exception
-    {
-        QString mMsg;
-      public:
-        Exception( const char *msg ) : mMsg( msg ) {}
-        QString what() const { return mMsg; }
-    };
-
     //! Get info about the mode
     /*! QgsGrass may be running in active or passive mode.
      *  Active mode means that GISRC is set up and GISRC file is available,
@@ -70,9 +64,10 @@
     */
     static GRASS_EXPORT void setMapset( QString gisdbase, QString location, QString mapset );
 
-    //! Error codes returned by error()
+    //! Error codes returned by GetError()
     enum GERROR { OK, /*!< OK. No error. */
-                  WARNING /*!< Warning, non fatal error. Should be printed by application. */
+                  WARNING, /*!< Warning, non fatal error. Should be printed by application. */
+                  FATAL /*!< Fatal error. Function faild. */
               };
 
     //! Map type
@@ -82,10 +77,10 @@
     static GRASS_EXPORT void resetError( void );  // reset error status
 
     //! Check if any error occured in lately called functions. Returns value from ERROR.
-    static GRASS_EXPORT int error( void );
+    static GRASS_EXPORT int getError( void );
 
     //! Get last error message
-    static GRASS_EXPORT QString errorMessage( void );
+    static GRASS_EXPORT QString getErrorMessage( void );
 
     /** \brief Open existing GRASS mapset
      * \return NULL string or error message
@@ -165,6 +160,10 @@
     static GRASS_EXPORT int versionRelease();
     static GRASS_EXPORT QString versionString();
 
+    static GRASS_EXPORT jmp_buf& fatalErrorEnv();
+    static GRASS_EXPORT void clearErrorEnv();
+
+
   private:
     static int initialized; // Set to 1 after initialization
     static bool active; // is active mode
@@ -173,7 +172,7 @@
     static QString defaultMapset;
 
     /* last error in GRASS libraries */
-    static GERROR lastError;         // static, because used in constructor
+    static GERROR error;         // static, because used in constructor
     static QString error_message;
 
     // G_set_error_routine has two versions of the function's first argument it expects:
@@ -189,6 +188,10 @@
     static QString mGisrc;
     // Temporary directory where GISRC and sockets are stored
     static QString mTmp;
+
+    // Context saved before a call to routine that can produce a fatal error
+    static jmp_buf mFatalErrorEnv;
+    static bool mFatalErrorEnvActive;
 };
 
 #endif // QGSGRASS_H

Modified: trunk/qgis/src/providers/grass/qgsgrassprovider.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrassprovider.cpp	2009-08-19 12:45:38 UTC (rev 11433)
+++ trunk/qgis/src/providers/grass/qgsgrassprovider.cpp	2009-08-19 12:59:39 UTC (rev 11434)
@@ -300,8 +300,7 @@
   if ( isEdited() || isFrozen() || !mValid )
     return false;
 
-  if ( mCidxFieldIndex < 0 || mNextCidx < mCidxFieldNumCats )
-    return false; // No features, no features in this layer
+  if ( mCidxFieldIndex < 0 ) return false; // No features, no features in this layer
 
   // Get next line/area id
   int found = 0;
@@ -310,17 +309,12 @@
     Vect_cidx_get_cat_by_index( mMap, mCidxFieldIndex, mNextCidx++, &cat, &type, &id );
     // Warning: selection array is only of type line/area of current layer -> check type first
 
-    if ( !( type & mGrassType ) )
-      continue;
-
-    if ( !mSelection[id] )
-      continue;
-
+    if ( !( type & mGrassType ) ) continue;
+    if ( !mSelection[id] ) continue;
     found = 1;
     break;
   }
-  if ( !found )
-    return false; // No more features
+  if ( !found ) return false; // No more features
 #if QGISDEBUG > 3
   QgsDebugMsg( QString( "cat = %1 type = %2 id = %3" ).arg( cat ).arg( type ).arg( id ) );
 #endif
@@ -661,15 +655,16 @@
 
   // Open map
   QgsGrass::init();
-
-  try
+  QgsGrass::resetError();
+  if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
   {
     layer.mapId = openMap( gisdbase, location, mapset, mapName );
   }
-  catch ( QgsGrass::Exception &e )
+  QgsGrass::clearErrorEnv();
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    Q_UNUSED( e );
-    QgsDebugMsg( QString( "Cannot open vector map: %1" ).arg( e.what() ) );
+    QgsDebugMsg( QString( "Cannot open vector map: %1" ).arg( QgsGrass::getErrorMessage() ) );
     return -1;
   }
 
@@ -1025,55 +1020,53 @@
 
   // Do we have topology and cidx (level2)
   int level = 2;
-  try
+  QgsGrass::resetError();
+  Vect_set_open_level( 2 );
+  Vect_open_old_head( map.map, mapName.toAscii().data(), mapset.toAscii().data() );
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    Vect_set_open_level( 2 );
-    Vect_open_old_head( map.map, mapName.toAscii().data(), mapset.toAscii().data() );
-    Vect_close( map.map );
+    QgsDebugMsg( QString( "Cannot open GRASS vector head on level2: %1" ).arg( QgsGrass::getErrorMessage() ) );
+    level = 1;
   }
-  catch ( QgsGrass::Exception &e )
+  else
   {
-    QgsDebugMsg( QString( "Cannot open GRASS vector head on level2: %1" ).arg( e.what() ) );
-    level = 1;
+    Vect_close( map.map );
   }
 
   if ( level == 1 )
   {
     QMessageBox::StandardButton ret = QMessageBox::question( 0, "Warning",
-                                      tr( "GRASS vector map %1 does not have topology. Build topology?" ).arg( mapName ),
+                                      "GRASS vector map " + mapName +
+                                      + " does not have topology. Build topology?",
                                       QMessageBox::Ok | QMessageBox::Cancel );
 
     if ( ret == QMessageBox::Cancel ) return -1;
   }
 
   // Open vector
-  try
+  QgsGrass::resetError(); // to "catch" error after Vect_open_old()
+  Vect_set_open_level( level );
+  Vect_open_old( map.map, mapName.toAscii().data(), mapset.toAscii().data() );
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    Vect_set_open_level( level );
-    Vect_open_old( map.map, mapName.toAscii().data(), mapset.toAscii().data() );
-  }
-  catch ( QgsGrass::Exception &e )
-  {
-    Q_UNUSED( e );
-    QgsDebugMsg( QString( "Cannot open GRASS vector: %1" ).arg( e.what() ) );
+    QgsDebugMsg( QString( "Cannot open GRASS vector: %1" ).arg( QgsGrass::getErrorMessage() ) );
     return -1;
   }
 
   if ( level == 1 )
   {
-    try
-    {
+    QgsGrass::resetError();
 #if defined(GRASS_VERSION_MAJOR) && defined(GRASS_VERSION_MINOR) && \
     ( ( GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR >= 4 ) || GRASS_VERSION_MAJOR > 6 )
-      Vect_build( map.map );
+    Vect_build( map.map );
 #else
-      Vect_build( map.map, stderr );
+    Vect_build( map.map, stderr );
 #endif
-    }
-    catch ( QgsGrass::Exception &e )
+
+    if ( QgsGrass::getError() == QgsGrass::FATAL )
     {
-      Q_UNUSED( e );
-      QgsDebugMsg( QString( "Cannot build topology: %1" ).arg( e.what() ) );
+      QgsDebugMsg( QString( "Cannot build topology: %1" ).arg( QgsGrass::getErrorMessage() ) );
       return -1;
     }
   }
@@ -1114,15 +1107,17 @@
   map->lastAttributesModified = di.lastModified();
 
   // Reopen vector
-  try
+  QgsGrass::resetError(); // to "catch" error after Vect_open_old()
+  Vect_set_open_level( 2 );
+  if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
   {
-    Vect_set_open_level( 2 );
     Vect_open_old( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
   }
-  catch ( QgsGrass::Exception &e )
+  QgsGrass::clearErrorEnv();
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    Q_UNUSED( e );
-    QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( e.what() ) );
+    QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( QgsGrass::getErrorMessage() ) );
 
     // if reopen fails, mLayers should be also updated
     for ( unsigned int i = 0; i <  mLayers.size(); i++ )
@@ -1273,7 +1268,7 @@
     GATT *att = ( GATT * ) bsearch( &key, mLayers[layerId].attributes, mLayers[layerId].nAttributes,
                                     sizeof( GATT ), cmpAtt );
 
-    for ( QgsAttributeList::const_iterator iter = attlist.begin(); iter != attlist.end(); ++iter )
+    for ( QgsAttributeList::const_iterator iter = attlist.begin(); iter != attlist.end();++iter )
     {
       if ( att != NULL )
       {
@@ -1311,15 +1306,16 @@
   const char *oldlocale = setlocale( LC_NUMERIC, NULL );
   setlocale( LC_NUMERIC, "C" );
 
-  try
+  if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
   {
     G_get_default_window( &cellhd );
   }
-  catch ( QgsGrass::Exception &e )
+  QgsGrass::clearErrorEnv();
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    Q_UNUSED( e );
     setlocale( LC_NUMERIC, oldlocale );
-    QgsDebugMsg( QString( "Cannot get default window: %1" ).arg( e.what() ) );
+    QgsDebugMsg( QString( "Cannot get default window: %1" ).arg( QgsGrass::getErrorMessage() ) );
     return QgsCoordinateReferenceSystem();
   }
 
@@ -1477,37 +1473,40 @@
   Vect_close( map->map );
 
   // TODO: Catch error
-  int level = -1;
-  try
-  {
-    level = Vect_open_update( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
-    if ( level < 2 )
-      QgsDebugMsg( "Cannot open GRASS vector for update on level 2." );
-  }
-  catch ( QgsGrass::Exception &e )
-  {
-    Q_UNUSED( e );
-    QgsDebugMsg( QString( "Cannot open GRASS vector for update: %1" ).arg( e.what() ) );
-  }
 
+  QgsGrass::resetError();
+  int level = Vect_open_update( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
   if ( level < 2 )
   {
-    // reopen vector for reading
-    try
+    if ( QgsGrass::getError() == QgsGrass::FATAL )
     {
-      Vect_set_open_level( 2 );
-      level = Vect_open_old( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
-      if ( level < 2 )
-        QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( QgsGrass::errorMessage() ) );
+      QgsDebugMsg( QString( "Cannot open GRASS vector for update: %1" ).arg( QgsGrass::getErrorMessage() ) );
     }
-    catch ( QgsGrass::Exception &e )
+    else
     {
-      Q_UNUSED( e );
-      QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( e.what() ) );
+      QgsDebugMsg( "Cannot open GRASS vector for update on level 2." );
     }
 
-    if ( level >= 2 )
+    // reopen vector for reading
+    QgsGrass::resetError();
+    Vect_set_open_level( 2 );
+    level = Vect_open_old( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
+
+    if ( level < 2 )
+    {
+      if ( QgsGrass::getError() == QgsGrass::FATAL )
+      {
+        QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( QgsGrass::getErrorMessage() ) );
+      }
+      else
+      {
+        QgsDebugMsg( "Cannot reopen GRASS vector on level 2." );
+      }
+    }
+    else
+    {
       map->valid = true;
+    }
 
     return false;
   }
@@ -1589,15 +1588,14 @@
   map->lastAttributesModified = di.lastModified();
 
   // Reopen vector
-  try
+  QgsGrass::resetError(); // to "catch" error after Vect_open_old()
+  Vect_set_open_level( 2 );
+
+  Vect_open_old( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
+
+  if ( QgsGrass::getError() == QgsGrass::FATAL )
   {
-    Vect_set_open_level( 2 );
-    Vect_open_old( map->map, map->mapName.toAscii().data(), map->mapset.toAscii().data() );
-  }
-  catch ( QgsGrass::Exception &e )
-  {
-    Q_UNUSED( e );
-    QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( e.what() ) );
+    QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( QgsGrass::getErrorMessage() ) );
     return false;
   }
 



More information about the QGIS-commit mailing list