Skip to content

Commit 08e39fc

Browse files
committed
GRASS 7.1 fixes
1 parent b1b0db6 commit 08e39fc

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/providers/grass/qgsgrass.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ extern "C"
5353
#if GRASS_VERSION_MAJOR >= 7
5454
#define G_suppress_masking Rast_suppress_masking
5555
#define BOUND_BOX bound_box
56+
#if GRASS_VERSION_MINOR >= 1
57+
#define G_available_mapsets G_get_available_mapsets
58+
#endif
5659
#endif
5760

5861
#if !defined(GRASS_VERSION_MAJOR) || \
@@ -439,14 +442,14 @@ int QgsGrass::error_routine( const char *msg, int fatal )
439442
lastError = FATAL;
440443

441444
#if (GRASS_VERSION_MAJOR == 7) && (GRASS_VERSION_MINOR == 0)
442-
// G_fatal_error in GRASS 7.0.0beta1 always exists the second time it is called.
443-
if ( QString( GRASS_VERSION_RELEASE_STRING ) == "0beta1" )
444-
{
445-
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 ) );
446-
}
445+
// G_fatal_error in GRASS 7.0.0beta1 always exits the second time it is called. This was fixed in 7.1.
446+
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 ) );
447447
#endif
448448

449+
#if (GRASS_VERSION_MAJOR < 7) || (GRASS_VERSION_MAJOR == 7 && GRASS_VERSION_MINOR == 0)
450+
// longjump() is called by G_fatal_error in GRASS >= 7.1
449451
longjmp( QgsGrass::jumper, 1 );
452+
#endif
450453
}
451454
else
452455
{

src/providers/grass/qgsgrass.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ class QgsRectangle;
4242
#define EXPAND(x) STR(x)
4343
#define GRASS_VERSION_RELEASE_STRING EXPAND( GRASS_VERSION_RELEASE )
4444

45+
#if (GRASS_VERSION_MAJOR < 7) || (GRASS_VERSION_MAJOR == 7 && GRASS_VERSION_MINOR == 0)
4546
#define G_TRY try { if( !setjmp( QgsGrass::jumper ) )
46-
// Ready for > 7.0.beta1
47-
//#define G_TRY try { if( !setjmp(*G_fatal_longjmp(1)) )
47+
#else
48+
#define G_TRY try { if( !setjmp(*G_fatal_longjmp(1)) )
49+
#endif
4850
#define G_CATCH else { throw QgsGrass::Exception( QgsGrass::errorMessage() ); } } catch
4951

5052
/*!

0 commit comments

Comments
 (0)