Skip to content
Permalink
Browse files
[GRASS] call init when provider is loaded to get it called on main th…
…read
  • Loading branch information
blazek committed May 29, 2015
1 parent 81ef171 commit 7267d017ac12027ec71e6a88565f2f8662459e85
Showing with 9 additions and 4 deletions.
  1. +5 −4 src/providers/grass/qgsgrass.cpp
  2. +4 −0 src/providers/grass/qgsgrassprovidermodule.cpp
@@ -251,6 +251,7 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )
if ( initialized )
return;

QgsDebugMsg( "do init" );
QSettings settings;

// Is it active mode ?
@@ -1071,12 +1072,12 @@ QStringList GRASS_LIB_EXPORT QgsGrass::vectorLayers( const QString& gisdbase, co

/* Points */
int npoints = Vect_cidx_get_type_count( &map, field, GV_POINT );
QgsDebugMsg( QString( "npoints = %1" ).arg( npoints ) );
if ( npoints > 0 )
{
QString l = fs + "_point";
list.append( l );
}
QgsDebugMsg( QString( "npoints = %1" ).arg( npoints ) );

/* Lines */
/* Lines without category appears in layer 0, but not boundaries */
@@ -1087,30 +1088,30 @@ QStringList GRASS_LIB_EXPORT QgsGrass::vectorLayers( const QString& gisdbase, co
tp = GV_LINE | GV_BOUNDARY;

int nlines = Vect_cidx_get_type_count( &map, field, tp );
QgsDebugMsg( QString( "nlines = %1" ).arg( nlines ) );
if ( nlines > 0 )
{
QString l = fs + "_line";
list.append( l );
}
QgsDebugMsg( QString( "nlines = %1" ).arg( nlines ) );

/* Faces */
int nfaces = Vect_cidx_get_type_count( &map, field, GV_FACE );
QgsDebugMsg( QString( "nfaces = %1" ).arg( nfaces ) );
if ( nfaces > 0 )
{
QString l = fs + "_face";
list.append( l );
}
QgsDebugMsg( QString( "nfaces = %1" ).arg( nfaces ) );

/* Polygons */
int nareas = Vect_cidx_get_type_count( &map, field, GV_AREA );
QgsDebugMsg( QString( "nareas = %1" ).arg( nareas ) );
if ( nareas > 0 )
{
QString l = fs + "_polygon";
list.append( l );
}
QgsDebugMsg( QString( "nareas = %1" ).arg( nareas ) );
}
QgsDebugMsg( "standard layers listed: " + list.join( "," ) );

@@ -865,5 +865,9 @@ QGISEXTERN QString description()
*/
QGISEXTERN bool isProvider()
{
// Init GRASS in the first function called by provider registry so that it is called
// on main thread, not sure but suspicious that init in thread is causing problems,
// at least on Windows, not that dataItem() is called in thread
QgsGrass::init();
return true;
}

0 comments on commit 7267d01

Please sign in to comment.