Skip to content

Commit

Permalink
fix crash from #2067. anyway loading of osm layers with custom render…
Browse files Browse the repository at this point in the history
…ers doesn't work (and won't work because of technical limitations)

git-svn-id: http://svn.osgeo.org/qgis/trunk@12041 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 8, 2009
1 parent c1b360b commit 61d45be
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2232,6 +2232,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
// deal with unnecessary schema qualification to make v.in.ogr happy
mDataSource = mDataProvider->dataSourceUri();
}
else if ( mProviderKey == "osm" )
{
// make sure that the "observer" has been removed from URI to avoid crashes
mDataSource = mDataProvider->dataSourceUri();
}

// label
mLabel = new QgsLabel( mDataProvider->fields() );
Expand Down
16 changes: 16 additions & 0 deletions src/providers/osm/osmprovider.cpp
Expand Up @@ -93,9 +93,25 @@ QgsOSMDataProvider::QgsOSMDataProvider( QString uri )
}
if ( propName == "observer" )
{
// remove observer from the URI
// (because otherwise it would be saved into project file and would cause crashes)
QString newProps;
foreach ( QString p , props )
{
if (!p.startsWith("observer"))
{
if (!newProps.isEmpty())
newProps += "&";
newProps += p;
}
}
QString newUri = uri.left( fileNameEnd + 1 ) + newProps;
setDataSourceUri(newUri);

ulong observerAddr = propValue.toULong();
mInitObserver = ( QObject* ) observerAddr;
mInitObserver->setProperty( "osm_state", QVariant( 1 ) );

}
if ( propName == "tag" )
{
Expand Down

0 comments on commit 61d45be

Please sign in to comment.