Skip to content
Permalink
Browse files

[GRASS] start/close edit fixes

  • Loading branch information
blazek committed Oct 5, 2015
1 parent d3f79af commit b09877b70bdb524f16ada94ab3b41055b2e44ca4
@@ -585,13 +585,15 @@ bool QgsGrassProvider::closeEdit( bool newMap, QgsVectorLayer *vectorLayer )

mEditBuffer = 0;
mEditLayer = 0;
mLayer->closeEdit();
if ( mLayer->map()->closeEdit( newMap ) )
{
loadMapInfo();
if ( vectorLayer )
{
vectorLayer->updateFields();
}
connect( mLayer->map(), SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
return true;
}
return false;
@@ -1006,7 +1008,10 @@ void QgsGrassProvider::startEditing( QgsVectorLayer *vectorLayer )
return;
}

// disconnect dataChanged() because the changes are done here and we know about them
disconnect( mLayer->map(), SIGNAL( dataChanged() ), this, SLOT( onDataChanged() ) );
mLayer->map()->startEdit();
mLayer->startEdit();

mEditBuffer = vectorLayer->editBuffer();
connect( mEditBuffer, SIGNAL( featureAdded( QgsFeatureId ) ), SLOT( onFeatureAdded( QgsFeatureId ) ) );
@@ -283,11 +283,6 @@ bool QgsGrassVectorMap::startEdit()

mIsEdited = true;

Q_FOREACH ( QgsGrassVectorMapLayer *l, mLayers )
{
l->startEdit();
}

mValid = true;
printDebug();

@@ -312,10 +307,6 @@ bool QgsGrassVectorMap::closeEdit( bool newMap )
closeAllIterators(); // blocking

QgsGrass::lock();
Q_FOREACH ( QgsGrassVectorMapLayer *l, mLayers )
{
l->closeEdit();
}

mOldLids.clear();
mNewLids.clear();
@@ -383,6 +374,10 @@ QgsGrassVectorMapLayer * QgsGrassVectorMap::openLayer( int field )
{
QgsDebugMsg( "Layer exists" );
layer = l;
if ( layer->userCount() == 0 )
{
layer->load();
}
}
}

@@ -475,6 +475,7 @@ void QgsGrassVectorMapLayer::closeEdit()
if ( mDriver )
{
db_close_database_shutdown_driver( mDriver );
mDriver = 0;
}
}

0 comments on commit b09877b

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