File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2232,6 +2232,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
22322232 // deal with unnecessary schema qualification to make v.in.ogr happy
22332233 mDataSource = mDataProvider ->dataSourceUri ();
22342234 }
2235+ else if ( mProviderKey == " osm" )
2236+ {
2237+ // make sure that the "observer" has been removed from URI to avoid crashes
2238+ mDataSource = mDataProvider ->dataSourceUri ();
2239+ }
22352240
22362241 // label
22372242 mLabel = new QgsLabel ( mDataProvider ->fields () );
Original file line number Diff line number Diff line change @@ -93,9 +93,25 @@ QgsOSMDataProvider::QgsOSMDataProvider( QString uri )
9393 }
9494 if ( propName == " observer" )
9595 {
96+ // remove observer from the URI
97+ // (because otherwise it would be saved into project file and would cause crashes)
98+ QString newProps;
99+ foreach ( QString p , props )
100+ {
101+ if (!p.startsWith (" observer" ))
102+ {
103+ if (!newProps.isEmpty ())
104+ newProps += " &" ;
105+ newProps += p;
106+ }
107+ }
108+ QString newUri = uri.left ( fileNameEnd + 1 ) + newProps;
109+ setDataSourceUri (newUri);
110+
96111 ulong observerAddr = propValue.toULong ();
97112 mInitObserver = ( QObject* ) observerAddr;
98113 mInitObserver ->setProperty ( " osm_state" , QVariant ( 1 ) );
114+
99115 }
100116 if ( propName == " tag" )
101117 {
You can’t perform that action at this time.
0 commit comments