Skip to content

Commit

Permalink
read source from provider before saving memory layer (fixes #8997)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Dec 30, 2015
1 parent 766bfa1 commit dbc0f07
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -46,6 +46,7 @@
#include "qgsrasterlayer.h"
#include "qgsrectangle.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"


QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
Expand Down Expand Up @@ -569,6 +570,11 @@ bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& docume
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
}
else if ( vlayer && vlayer->providerType() == "memory" )
{
// Refetch the source from the provider, because adding fields actually changes the source for this provider.
src = vlayer->dataProvider()->dataSourceUri();
}
else
{
bool handled = false;
Expand Down

0 comments on commit dbc0f07

Please sign in to comment.