Skip to content
Permalink
Browse files

fix crash from #2067. anyway loading of osm layers with custom render…

…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
wonder committed Nov 8, 2009
1 parent c1b360b commit 61d45be928a492e60c55b2a1e1a4998a3df6fe3a
Showing with 21 additions and 0 deletions.
  1. +5 −0 src/core/qgsvectorlayer.cpp
  2. +16 −0 src/providers/osm/osmprovider.cpp
@@ -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() );
@@ -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" )
{

0 comments on commit 61d45be

Please sign in to comment.
You can’t perform that action at this time.