File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ extern "C" {
3838
3939void QgsGrass::init ( void )
4040{
41+ // Warning!!!
42+ // G_set_error_routine() once called from plugin
43+ // is not valid in provider -> call it always
44+
45+ // Set error function
46+ G_set_error_routine ( &error_routine );
47+
4148 if ( initialized ) return ;
4249
4350 QSettings settings (" QuantumGIS" , " qgis" );
@@ -59,9 +66,6 @@ void QgsGrass::init( void )
5966 // Init GRASS libraries (required)
6067 G_no_gisinit (); // Doesn't check write permissions for mapset compare to G_gisinit("libgrass++");
6168
62- // Set error function
63- G_set_error_routine ( &error_routine );
64-
6569 // Set program name
6670 G_set_program_name (" QGIS" );
6771
@@ -258,6 +262,10 @@ QString QgsGrass::defaultGisdbase;
258262QString QgsGrass::defaultLocation;
259263QString QgsGrass::defaultMapset;
260264
265+ QString QgsGrass::mMapsetLock ;
266+ QString QgsGrass::mGisrc ;
267+ QString QgsGrass::mTmp ;
268+
261269int QgsGrass::error_routine ( char *msg, int fatal) {
262270 std::cerr << " error_routine (fatal = " << fatal << " ): " << msg << std::endl;
263271
Original file line number Diff line number Diff line change @@ -161,12 +161,13 @@ class QgsGrass {
161161 static QString error_message;
162162
163163 static int error_routine ( char *msg, int fatal); // static because pointer to this function is set later
164- };
164+
165165 // Current mapset lock file path
166166 static QString mMapsetLock ;
167167 // Current mapset GISRC file path
168168 static QString mGisrc ;
169169 // Temporary directory where GISRC and sockets are stored
170170 static QString mTmp ;
171+ };
171172
172173#endif // QGSGRASS_H
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ QgsGrassProvider::QgsGrassProvider(QString const & uri)
6262 std::cerr << " QgsGrassProvider URI: " << uri.toLocal8Bit ().data () << std::endl;
6363#endif
6464
65+ QgsGrass::init ();
66+
6567 QTime time;
6668 time.start ();
6769
You can’t perform that action at this time.
0 commit comments