Skip to content

Commit

Permalink
Undo changes in active edit command when it gets destroyed.
Browse files Browse the repository at this point in the history
Fixed return value for deletion of vertices.
Contributed by Richard Kostecky.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11143 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 22, 2009
1 parent 2d5865c commit 95be709
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsvectorlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public:
/** Finish edit command and add it to undo/redo stack */
void endEditCommand();

/** Destroy active command and deletes all changes in it */
/** Destroy active command and reverts all changes in it */
void destroyEditCommand();

/** Execute undo operation. To be called only from QgsVectorLayerUndoCommand. */
Expand Down
6 changes: 5 additions & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,10 @@ bool QgsVectorLayer::deleteVertex( int atFeatureId, int atVertex )
geometry = mChangedGeometries[atFeatureId];
}

geometry.deleteVertex( atVertex );
if (!geometry.deleteVertex( atVertex ))
{
return false;
}
mCachedGeometries[atFeatureId] = geometry;
editGeometryChange( atFeatureId, geometry );

Expand Down Expand Up @@ -3885,6 +3888,7 @@ void QgsVectorLayer::destroyEditCommand()
{
if ( mActiveCommand != NULL )
{
undoEditCommand( mActiveCommand );
delete mActiveCommand;
mActiveCommand = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Finish edit command and add it to undo/redo stack */
void endEditCommand();

/** Destroy active command and deletes all changes in it */
/** Destroy active command and reverts all changes in it */
void destroyEditCommand();

/** Execute undo operation. To be called only from QgsVectorLayerUndoCommand. */
Expand Down

0 comments on commit 95be709

Please sign in to comment.