Skip to content

Commit

Permalink
fixed setting error rutin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5093 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Mar 24, 2006
1 parent 808ab7e commit 5ca2143
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/providers/grass/qgsgrass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ extern "C" {

void QgsGrass::init( void )
{
// Warning!!!
// G_set_error_routine() once called from plugin
// is not valid in provider -> call it always

// Set error function
G_set_error_routine ( &error_routine );

if ( initialized ) return;

QSettings settings("QuantumGIS", "qgis");
Expand All @@ -59,9 +66,6 @@ void QgsGrass::init( void )
// Init GRASS libraries (required)
G_no_gisinit(); // Doesn't check write permissions for mapset compare to G_gisinit("libgrass++");

// Set error function
G_set_error_routine ( &error_routine );

// Set program name
G_set_program_name ("QGIS");

Expand Down Expand Up @@ -258,6 +262,10 @@ QString QgsGrass::defaultGisdbase;
QString QgsGrass::defaultLocation;
QString QgsGrass::defaultMapset;

QString QgsGrass::mMapsetLock;
QString QgsGrass::mGisrc;
QString QgsGrass::mTmp;

int QgsGrass::error_routine ( char *msg, int fatal) {
std::cerr << "error_routine (fatal = " << fatal << "): " << msg << std::endl;

Expand Down
3 changes: 2 additions & 1 deletion src/providers/grass/qgsgrass.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ class QgsGrass {
static QString error_message;

static int error_routine ( char *msg, int fatal); // static because pointer to this function is set later
};

// Current mapset lock file path
static QString mMapsetLock;
// Current mapset GISRC file path
static QString mGisrc;
// Temporary directory where GISRC and sockets are stored
static QString mTmp;
};

#endif // QGSGRASS_H
2 changes: 2 additions & 0 deletions src/providers/grass/qgsgrassprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ QgsGrassProvider::QgsGrassProvider(QString const & uri)
std::cerr << "QgsGrassProvider URI: " << uri.toLocal8Bit().data() << std::endl;
#endif

QgsGrass::init();

QTime time;
time.start();

Expand Down

0 comments on commit 5ca2143

Please sign in to comment.