diff --git a/src/providers/grass/qgsgrass.cpp b/src/providers/grass/qgsgrass.cpp index b2df2ad8c27..db57b8ac3cf 100644 --- a/src/providers/grass/qgsgrass.cpp +++ b/src/providers/grass/qgsgrass.cpp @@ -53,6 +53,9 @@ extern "C" #if GRASS_VERSION_MAJOR >= 7 #define G_suppress_masking Rast_suppress_masking #define BOUND_BOX bound_box +#if GRASS_VERSION_MINOR >= 1 +#define G_available_mapsets G_get_available_mapsets +#endif #endif #if !defined(GRASS_VERSION_MAJOR) || \ @@ -439,14 +442,14 @@ int QgsGrass::error_routine( const char *msg, int fatal ) lastError = FATAL; #if (GRASS_VERSION_MAJOR == 7) && (GRASS_VERSION_MINOR == 0) - // G_fatal_error in GRASS 7.0.0beta1 always exists the second time it is called. - if ( QString( GRASS_VERSION_RELEASE_STRING ) == "0beta1" ) - { - QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr( "Fatal error occurred in GRASS library. QGIS gets over the error but any next fatal error will cause QGIS exit without warning. This is a problem of GRASS 7.0.0beta1 and hopefully will be fixed in higher GRASS versions. Error message: %1" ).arg( msg ) ); - } + // G_fatal_error in GRASS 7.0.0beta1 always exits the second time it is called. This was fixed in 7.1. + QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr( "Fatal error occurred in GRASS library. QGIS gets over the error but any next fatal error will cause QGIS exit without warning. This is a problem of GRASS 7.0.0beta1 but it is fixed in GRASS 7.1 and higher. Error message: %1" ).arg( msg ) ); #endif +#if (GRASS_VERSION_MAJOR < 7) || (GRASS_VERSION_MAJOR == 7 && GRASS_VERSION_MINOR == 0) + // longjump() is called by G_fatal_error in GRASS >= 7.1 longjmp( QgsGrass::jumper, 1 ); +#endif } else { diff --git a/src/providers/grass/qgsgrass.h b/src/providers/grass/qgsgrass.h index 84fbabe90f7..d02911fa3ed 100644 --- a/src/providers/grass/qgsgrass.h +++ b/src/providers/grass/qgsgrass.h @@ -42,9 +42,11 @@ class QgsRectangle; #define EXPAND(x) STR(x) #define GRASS_VERSION_RELEASE_STRING EXPAND( GRASS_VERSION_RELEASE ) +#if (GRASS_VERSION_MAJOR < 7) || (GRASS_VERSION_MAJOR == 7 && GRASS_VERSION_MINOR == 0) #define G_TRY try { if( !setjmp( QgsGrass::jumper ) ) -// Ready for > 7.0.beta1 -//#define G_TRY try { if( !setjmp(*G_fatal_longjmp(1)) ) +#else +#define G_TRY try { if( !setjmp(*G_fatal_longjmp(1)) ) +#endif #define G_CATCH else { throw QgsGrass::Exception( QgsGrass::errorMessage() ); } } catch /*!