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
(cherry picked from commit dbc0f07)
  • Loading branch information
SebDieBln authored and jef-n committed Jan 1, 2016
1 parent 4c3cf64 commit a6f10f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -45,6 +45,7 @@
#include "qgsrasterlayer.h"
#include "qgsrectangle.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"


QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
Expand Down Expand Up @@ -549,6 +550,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 a6f10f4

Please sign in to comment.