Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 7267d01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -251,6 +251,7 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )
if ( initialized )
return;

QgsDebugMsg( "do init" );
QSettings settings;

// Is it active mode ?
Expand Down Expand Up @@ -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 */
Expand All @@ -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( "," ) );

Expand Down
4 changes: 4 additions & 0 deletions src/providers/grass/qgsgrassprovidermodule.cpp
Expand Up @@ -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.