Skip to content

Commit

Permalink
[GRASS] fixed crash in add/delete column
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Sep 29, 2015
1 parent d70c854 commit 63ddb15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/providers/grass/qgsgrassprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ void QgsGrassProvider::thaw()
#endif
}

bool QgsGrassProvider::closeEdit( bool newMap )
bool QgsGrassProvider::closeEdit( bool newMap, QgsVectorLayer *vectorLayer )
{
QgsDebugMsg( "entered" );

Expand All @@ -576,6 +576,10 @@ bool QgsGrassProvider::closeEdit( bool newMap )
if ( mLayer->map()->closeEdit( newMap ) )
{
loadMapInfo();
if ( vectorLayer )
{
vectorLayer->updateFields();
}
return true;
}
return false;
Expand Down Expand Up @@ -1005,6 +1009,9 @@ void QgsGrassProvider::startEditing( QgsVectorLayer *vectorLayer )

connect( vectorLayer->undoStack(), SIGNAL( indexChanged( int ) ), this, SLOT( onUndoIndexChanged( int ) ) );

// let qgis know (attribute table etc.) that we added topo symbol field
vectorLayer->updateFields();

QgsDebugMsg( "edit started" );
}

Expand Down Expand Up @@ -1465,7 +1472,8 @@ void QgsGrassProvider::onBeforeRollBack()
void QgsGrassProvider::onEditingStopped()
{
QgsDebugMsg( "entered" );
closeEdit( false );
QgsVectorLayer *vectorLayer = qobject_cast<QgsVectorLayer *>( sender() );
closeEdit( false, vectorLayer );
}

// -------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/providers/grass/qgsgrassprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class GRASS_LIB_EXPORT QgsGrassProvider : public QgsVectorDataProvider
* @return true success
* @return false failed to close vector or vector was not in update mode
*/
bool closeEdit( bool newMap = false );
bool closeEdit( bool newMap = false, QgsVectorLayer *vectorLayer = 0 );

/** Get current number of lines.
* @return number of lines
Expand Down

0 comments on commit 63ddb15

Please sign in to comment.