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
Expand Up @@ -38,6 +38,13 @@ extern "C" {


void QgsGrass::init( void ) 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; if ( initialized ) return;


QSettings settings("QuantumGIS", "qgis"); QSettings settings("QuantumGIS", "qgis");
Expand All @@ -59,9 +66,6 @@ void QgsGrass::init( void )
// Init GRASS libraries (required) // Init GRASS libraries (required)
G_no_gisinit(); // Doesn't check write permissions for mapset compare to G_gisinit("libgrass++"); 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 // Set program name
G_set_program_name ("QGIS"); G_set_program_name ("QGIS");


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


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

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


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


static int error_routine ( char *msg, int fatal); // static because pointer to this function is set later static int error_routine ( char *msg, int fatal); // static because pointer to this function is set later
};
// Current mapset lock file path // Current mapset lock file path
static QString mMapsetLock; static QString mMapsetLock;
// Current mapset GISRC file path // Current mapset GISRC file path
static QString mGisrc; static QString mGisrc;
// Temporary directory where GISRC and sockets are stored // Temporary directory where GISRC and sockets are stored
static QString mTmp; static QString mTmp;
};


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


QgsGrass::init();

QTime time; QTime time;
time.start(); time.start();


Expand Down

0 comments on commit 5ca2143

Please sign in to comment.