Skip to content

Commit 5ca2143

Browse files
author
rblazek
committed
fixed setting error rutin
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5093 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 808ab7e commit 5ca2143

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/providers/grass/qgsgrass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ extern "C" {
3838

3939
void 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;
258262
QString QgsGrass::defaultLocation;
259263
QString QgsGrass::defaultMapset;
260264

265+
QString QgsGrass::mMapsetLock;
266+
QString QgsGrass::mGisrc;
267+
QString QgsGrass::mTmp;
268+
261269
int QgsGrass::error_routine ( char *msg, int fatal) {
262270
std::cerr << "error_routine (fatal = " << fatal << "): " << msg << std::endl;
263271

src/providers/grass/qgsgrass.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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

src/providers/grass/qgsgrassprovider.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)